File: BackchannelJsonSerializerContext.ValidationResult.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.Tool.csproj (aspire)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Aspire.Cli.Backchannel
{
    internal partial class BackchannelJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Spectre.Console.ValidationResult>? _ValidationResult;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Spectre.Console.ValidationResult> ValidationResult
        {
            get => _ValidationResult ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Spectre.Console.ValidationResult>)Options.GetTypeInfo(typeof(global::Spectre.Console.ValidationResult));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Spectre.Console.ValidationResult> Create_ValidationResult(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Spectre.Console.ValidationResult>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Spectre.Console.ValidationResult> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Spectre.Console.ValidationResult>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => ValidationResultPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    SerializeHandler = ValidationResultSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Spectre.Console.ValidationResult>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] ValidationResultPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Spectre.Console.ValidationResult),
                Converter = null,
                Getter = static obj => ((global::Spectre.Console.ValidationResult)obj).Successful,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Successful",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Spectre.Console.ValidationResult),
                Converter = null,
                Getter = static obj => ((global::Spectre.Console.ValidationResult)obj).Message,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Message",
                JsonPropertyName = null
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
 
            return properties;
        }
 
        // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
        // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
        private void ValidationResultSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Spectre.Console.ValidationResult? value)
        {
            if (value == null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteBoolean(PropName_Successful, ((global::Spectre.Console.ValidationResult)value).Successful);
            writer.WriteString(PropName_Message, ((global::Spectre.Console.ValidationResult)value).Message);
 
            writer.WriteEndObject();
        }
    }
}