33 instantiations of JsonSchema
Microsoft.Extensions.AI.Abstractions (33)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (29)
112return CompleteSchema(ref state, new JsonSchema { Ref = existingJsonPointer }); 159JsonSchema discriminatorSchema = new() { Constant = discriminatorNode }; 210schema = new() 337return CompleteSchema(ref state, new() 355return CompleteSchema(ref state, new() 379return CompleteSchema(ref state, new() 386new JsonSchema 417return CompleteSchema(ref state, new() 582[typeof(bool)] = _ => new JsonSchema { Type = JsonSchemaType.Boolean }, 601[typeof(char)] = _ => new JsonSchema { Type = JsonSchemaType.String, MinLength = 1, MaxLength = 1 }, 602[typeof(string)] = _ => new JsonSchema { Type = JsonSchemaType.String }, 603[typeof(byte[])] = _ => new JsonSchema { Type = JsonSchemaType.String }, 604[typeof(Memory<byte>)] = _ => new JsonSchema { Type = JsonSchemaType.String }, 605[typeof(ReadOnlyMemory<byte>)] = _ => new JsonSchema { Type = JsonSchemaType.String }, 606[typeof(DateTime)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "date-time" }, 607[typeof(DateTimeOffset)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "date-time" }, 608[typeof(TimeSpan)] = _ => new JsonSchema 619[typeof(Guid)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "uuid" }, 620[typeof(Uri)] = _ => new JsonSchema { Type = JsonSchemaType.String, Format = "uri" }, 621[typeof(Version)] = _ => new JsonSchema 632[typeof(JsonObject)] = _ => new JsonSchema { Type = JsonSchemaType.Object }, 633[typeof(JsonArray)] = _ => new JsonSchema { Type = JsonSchemaType.Array }, 664return new JsonSchema 668new JsonSchema { Type = schemaType, Pattern = pattern }, 669new JsonSchema { Enum = new() { (JsonNode)"NaN", (JsonNode)"Infinity", (JsonNode)"-Infinity" } }, 674return new JsonSchema { Type = schemaType, Pattern = pattern }; 749return new() { Type = JsonSchemaType.String }; 761return new() { Enum = enumValues }; 764return new() { Type = JsonSchemaType.Integer };
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (4)
20public static JsonSchema CreateFalseSchema() => new(false); 21public static JsonSchema CreateTrueSchema() => new(true); 470schema = new JsonSchema { Not = JsonSchema.CreateTrueSchema() }; 473schema = new JsonSchema();
47 references to JsonSchema
Microsoft.Extensions.AI.Abstractions (47)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (31)
83JsonSchema schema = MapJsonSchemaCore(ref state, typeInfo); 88private static JsonSchema MapJsonSchemaCore( 101KeyValuePair<string, JsonSchema>? typeDiscriminator = null, 115JsonSchema schema; 122return CompleteSchema(ref state, JsonSchema.CreateTrueSchema()); 142List<JsonSchema>? anyOf = new(derivedTypes.Count); 150KeyValuePair<string, JsonSchema>? derivedTypeDiscriminator = null; 159JsonSchema discriminatorSchema = new() { Constant = discriminatorNode }; 166JsonSchema derivedSchema = MapJsonSchemaCore( 196foreach (JsonSchema derivedSchema in anyOf) 240List<KeyValuePair<string, JsonSchema>>? properties = null; 242JsonSchema? additionalProperties = null; 248additionalProperties = JsonSchema.CreateFalseSchema(); 308JsonSchema propertySchema = MapJsonSchemaCore( 323JsonSchema.EnsureMutable(ref propertySchema); 352JsonSchema items = MapJsonSchemaCore(ref state, elementTypeInfo, customNumberHandling: effectiveNumberHandling); 373JsonSchema items = MapJsonSchemaCore(ref state, elementTypeInfo, customNumberHandling: effectiveNumberHandling); 400List<KeyValuePair<string, JsonSchema>>? dictProps = null; 414JsonSchema valueSchema = MapJsonSchemaCore(ref state, valueTypeInfo, customNumberHandling: effectiveNumberHandling); 428if (_simpleTypeSchemaFactories.TryGetValue(typeInfo.Type, out Func<JsonNumberHandling, JsonSchema>? simpleTypeSchemaFactory)) 438schema = JsonSchema.CreateTrueSchema(); 444JsonSchema CompleteSchema(ref GenerationState state, JsonSchema schema) 579private static readonly Dictionary<Type, Func<JsonNumberHandling, JsonSchema>> _simpleTypeSchemaFactories = new() 581[typeof(object)] = _ => JsonSchema.CreateTrueSchema(), 628[typeof(JsonDocument)] = _ => JsonSchema.CreateTrueSchema(), 629[typeof(JsonElement)] = _ => JsonSchema.CreateTrueSchema(), 630[typeof(JsonNode)] = _ => JsonSchema.CreateTrueSchema(), 631[typeof(JsonValue)] = _ => JsonSchema.CreateTrueSchema(), 637private static JsonSchema GetSchemaForNumericType(JsonSchemaType schemaType, JsonNumberHandling numberHandling, bool isIeeeFloatingPoint = false) 730private static JsonSchema GetEnumConverterSchema(JsonTypeInfo typeInfo, JsonConverter converter)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (16)
20public static JsonSchema CreateFalseSchema() => new(false); 21public static JsonSchema CreateTrueSchema() => new(true); 144public List<KeyValuePair<string, JsonSchema>>? Properties 154private List<KeyValuePair<string, JsonSchema>>? _properties; 168public JsonSchema? Items 178private JsonSchema? _items; 180public JsonSchema? AdditionalProperties 190private JsonSchema? _additionalProperties; 204public JsonSchema? Not 214private JsonSchema? _not; 216public List<JsonSchema>? AnyOf 226private List<JsonSchema>? _anyOf; 384foreach (KeyValuePair<string, JsonSchema> property in Properties) 426foreach (JsonSchema schema in AnyOf) 465public static void EnsureMutable(ref JsonSchema schema) 470schema = new JsonSchema { Not = JsonSchema.CreateTrueSchema() };