// <auto-generated/>
#nullable enable annotations
#nullable disable warnings
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
namespace Microsoft.Extensions.AI.JsonSchemaExporter
{
public static partial class TestTypes
{
public partial class TestTypesContext
{
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes>? _PocoWithNullableAnnotationAttributes;
/// <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::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes> PocoWithNullableAnnotationAttributes
#nullable enable annotations
{
get => _PocoWithNullableAnnotationAttributes ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes));
}
private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes> Create_PocoWithNullableAnnotationAttributes(global::System.Text.Json.JsonSerializerOptions options)
{
if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes> jsonTypeInfo))
{
var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes>
{
ObjectCreator = () => new global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes(),
ObjectWithParameterizedConstructorCreator = null,
PropertyMetadataInitializer = _ => PocoWithNullableAnnotationAttributesPropInit(options),
ConstructorParameterMetadataInitializer = null,
ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
SerializeHandler = PocoWithNullableAnnotationAttributesSerializeHandler,
};
jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes>(options, objectInfo);
jsonTypeInfo.NumberHandling = null;
}
jsonTypeInfo.OriginatingResolver = this;
return jsonTypeInfo;
}
private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] PocoWithNullableAnnotationAttributesPropInit(global::System.Text.Json.JsonSerializerOptions options)
{
var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[5];
var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes),
Converter = null,
Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).MaybeNull,
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).MaybeNull = value!,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "MaybeNull",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetProperty("MaybeNull", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
};
properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
properties[0].IsSetNullable = false;
var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes),
Converter = null,
Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).AllowNull,
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).AllowNull = value!,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "AllowNull",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetProperty("AllowNull", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
};
properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
properties[1].IsGetNullable = false;
var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes),
Converter = null,
Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).NotNull,
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).NotNull = value!,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "NotNull",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetProperty("NotNull", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
};
properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);
properties[2].IsGetNullable = false;
var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes),
Converter = null,
Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).DisallowNull,
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).DisallowNull = value!,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "DisallowNull",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetProperty("DisallowNull", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
};
properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info3);
properties[3].IsSetNullable = false;
var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
{
IsProperty = true,
IsPublic = true,
IsVirtual = false,
DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes),
Converter = null,
Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).NotNullDisallowNull,
Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)obj).NotNullDisallowNull = value!,
IgnoreCondition = null,
HasJsonInclude = false,
IsExtensionData = false,
NumberHandling = null,
PropertyName = "NotNullDisallowNull",
JsonPropertyName = null,
AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes).GetProperty("NotNullDisallowNull", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
};
properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info4);
properties[4].IsGetNullable = false;
properties[4].IsSetNullable = 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 PocoWithNullableAnnotationAttributesSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes? value)
{
if (value is null)
{
writer.WriteNullValue();
return;
}
writer.WriteStartObject();
writer.WriteString(PropName_MaybeNull, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)value).MaybeNull);
writer.WriteString(PropName_AllowNull, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)value).AllowNull);
writer.WriteString(PropName_NotNull, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)value).NotNull);
writer.WriteString(PropName_DisallowNull, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)value).DisallowNull);
writer.WriteString(PropName_NotNullDisallowNull, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.PocoWithNullableAnnotationAttributes)value).NotNullDisallowNull);
writer.WriteEndObject();
}
}
}
}