File: _generated\4\JsonContext.PackageVulnerabilityInfo.g.cs
Web Access
Project: src\src\nuget-client\src\NuGet.Core\NuGet.Protocol\NuGet.Protocol.csproj (NuGet.Protocol)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace NuGet.Protocol.Utility
{
    internal partial class JsonContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo>? _PackageVulnerabilityInfo;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        #nullable disable annotations // Marking the property type as nullable-oblivious.
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo> PackageVulnerabilityInfo
        #nullable enable annotations
        {
            get => _PackageVulnerabilityInfo ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo>)Options.GetTypeInfo(typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo> Create_PackageVulnerabilityInfo(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::NuGet.Protocol.Model.PackageVulnerabilityInfo>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::NuGet.Protocol.Model.PackageVulnerabilityInfo>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::NuGet.Protocol.Model.PackageVulnerabilityInfo((global::System.Uri)args[0], (global::NuGet.Protocol.PackageVulnerabilitySeverity)args[1], (global::NuGet.Versioning.VersionRange)args[2]),
                    PropertyMetadataInitializer = _ => PackageVulnerabilityInfoPropInit(options),
                    ConstructorParameterMetadataInitializer = PackageVulnerabilityInfoCtorParamInit,
                    ConstructorAttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(global::System.Uri), typeof(global::NuGet.Protocol.PackageVulnerabilitySeverity), typeof(global::NuGet.Versioning.VersionRange)}, modifiers: null),
                    SerializeHandler = PackageVulnerabilityInfoSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::NuGet.Protocol.Model.PackageVulnerabilityInfo>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PackageVulnerabilityInfoPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Uri>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)obj).Url,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Url",
                JsonPropertyName = "url",
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo).GetProperty("Url", InstanceMemberBindingFlags, null, typeof(global::System.Uri), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Uri>(options, info0);
            properties[0].IsGetNullable = false;

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::NuGet.Protocol.PackageVulnerabilitySeverity>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)obj).Severity,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Severity",
                JsonPropertyName = "severity",
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo).GetProperty("Severity", InstanceMemberBindingFlags, null, typeof(global::NuGet.Protocol.PackageVulnerabilitySeverity), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::NuGet.Protocol.PackageVulnerabilitySeverity>(options, info1);

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::NuGet.Versioning.VersionRange>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo),
                Converter = null,
                Getter = static obj => ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)obj).Versions,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Versions",
                JsonPropertyName = "versions",
                AttributeProviderFactory = static () => typeof(global::NuGet.Protocol.Model.PackageVulnerabilityInfo).GetProperty("Versions", InstanceMemberBindingFlags, null, typeof(global::NuGet.Versioning.VersionRange), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::NuGet.Versioning.VersionRange>(options, info2);
            properties[2].IsGetNullable = false;

            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 PackageVulnerabilityInfoSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::NuGet.Protocol.Model.PackageVulnerabilityInfo? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WritePropertyName(PropName_url);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)value).Url, Uri);
            writer.WritePropertyName(PropName_severity);
            global::System.Text.Json.JsonSerializer.Serialize(writer, ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)value).Severity, PackageVulnerabilitySeverity);
            writer.WritePropertyName(PropName_versions);
            VersionRangeSerializeHandler(writer, ((global::NuGet.Protocol.Model.PackageVulnerabilityInfo)value).Versions);

            writer.WriteEndObject();
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] PackageVulnerabilityInfoCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[]
        {
            new()
            {
                Name = "url",
                ParameterType = typeof(global::System.Uri),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "severity",
                ParameterType = typeof(global::NuGet.Protocol.PackageVulnerabilitySeverity),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },

            new()
            {
                Name = "versions",
                ParameterType = typeof(global::NuGet.Versioning.VersionRange),
                Position = 2,
                HasDefaultValue = false,
                DefaultValue = null,
                IsNullable = false,
            },
        };
    }
}