// <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.SimpleRecord>? _SimpleRecord; /// <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.SimpleRecord> SimpleRecord #nullable enable annotations { get => _SimpleRecord ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord>)Options.GetTypeInfo(typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)); } private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord> Create_SimpleRecord(global::System.Text.Json.JsonSerializerOptions options) { if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord> jsonTypeInfo)) { var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord> { ObjectCreator = null, ObjectWithParameterizedConstructorCreator = static args => new global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord((int)args[0], (string)args[1], (bool)args[2], (double)args[3]), PropertyMetadataInitializer = _ => SimpleRecordPropInit(options), ConstructorParameterMetadataInitializer = SimpleRecordCtorParamInit, ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord).GetConstructor(InstanceMemberBindingFlags, binder: null, new[] {typeof(int), typeof(string), typeof(bool), typeof(double)}, modifiers: null), SerializeHandler = SimpleRecordSerializeHandler, }; jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord>(options, objectInfo); jsonTypeInfo.NumberHandling = null; } jsonTypeInfo.OriginatingResolver = this; return jsonTypeInfo; } private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] SimpleRecordPropInit(global::System.Text.Json.JsonSerializerOptions options) { var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[4]; var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<int> { IsProperty = true, IsPublic = true, IsVirtual = false, DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord), Converter = null, Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)obj).X, Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."), IgnoreCondition = null, HasJsonInclude = false, IsExtensionData = false, NumberHandling = null, PropertyName = "X", JsonPropertyName = null, AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord).GetProperty("X", InstanceMemberBindingFlags, null, typeof(int), global::System.Array.Empty<global::System.Type>(), null), }; properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<int>(options, info0); 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.SimpleRecord), Converter = null, Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)obj).Y, Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."), IgnoreCondition = null, HasJsonInclude = false, IsExtensionData = false, NumberHandling = null, PropertyName = "Y", JsonPropertyName = null, AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord).GetProperty("Y", 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; properties[1].IsSetNullable = false; var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool> { IsProperty = true, IsPublic = true, IsVirtual = false, DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord), Converter = null, Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)obj).Z, Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."), IgnoreCondition = null, HasJsonInclude = false, IsExtensionData = false, NumberHandling = null, PropertyName = "Z", JsonPropertyName = null, AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord).GetProperty("Z", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null), }; properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info2); var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<double> { IsProperty = true, IsPublic = true, IsVirtual = false, DeclaringType = typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord), Converter = null, Getter = static obj => ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)obj).W, Setter = static (obj, value) => throw new global::System.InvalidOperationException("Setting init-only properties is not supported in source generation mode."), IgnoreCondition = null, HasJsonInclude = false, IsExtensionData = false, NumberHandling = null, PropertyName = "W", JsonPropertyName = null, AttributeProviderFactory = static () => typeof(global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord).GetProperty("W", InstanceMemberBindingFlags, null, typeof(double), global::System.Array.Empty<global::System.Type>(), null), }; properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<double>(options, info3); 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 SimpleRecordSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord? value) { if (value is null) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WriteNumber(PropName_X, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)value).X); writer.WriteString(PropName_Y, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)value).Y); writer.WriteBoolean(PropName_Z, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)value).Z); writer.WriteNumber(PropName_W, ((global::Microsoft.Extensions.AI.JsonSchemaExporter.TestTypes.SimpleRecord)value).W); writer.WriteEndObject(); } private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] SimpleRecordCtorParamInit() => new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] { new() { Name = "X", ParameterType = typeof(int), Position = 0, HasDefaultValue = false, DefaultValue = null, IsNullable = false, }, new() { Name = "Y", ParameterType = typeof(string), Position = 1, HasDefaultValue = false, DefaultValue = null, IsNullable = false, }, new() { Name = "Z", ParameterType = typeof(bool), Position = 2, HasDefaultValue = false, DefaultValue = null, IsNullable = false, }, new() { Name = "W", ParameterType = typeof(double), Position = 3, HasDefaultValue = false, DefaultValue = null, IsNullable = false, }, }; } } }