33 instantiations of JsonSchema
Microsoft.Extensions.AI.Abstractions (33)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (29)
112
return CompleteSchema(ref state, new
JsonSchema
{ Ref = existingJsonPointer });
159
JsonSchema discriminatorSchema =
new
() { Constant = discriminatorNode };
210
schema =
new
()
337
return CompleteSchema(ref state,
new
()
355
return CompleteSchema(ref state,
new
()
379
return CompleteSchema(ref state,
new
()
386
new
JsonSchema
417
return 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 },
664
return new
JsonSchema
668
new
JsonSchema
{ Type = schemaType, Pattern = pattern },
669
new
JsonSchema
{ Enum = new() { (JsonNode)"NaN", (JsonNode)"Infinity", (JsonNode)"-Infinity" } },
674
return new
JsonSchema
{ Type = schemaType, Pattern = pattern };
749
return
new
() { Type = JsonSchemaType.String };
761
return
new
() { Enum = enumValues };
764
return
new
() { Type = JsonSchemaType.Integer };
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (4)
20
public static JsonSchema CreateFalseSchema() =>
new
(false);
21
public static JsonSchema CreateTrueSchema() =>
new
(true);
470
schema = new
JsonSchema
{ Not = JsonSchema.CreateTrueSchema() };
473
schema = new
JsonSchema
();
47 references to JsonSchema
Microsoft.Extensions.AI.Abstractions (47)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (31)
83
JsonSchema
schema = MapJsonSchemaCore(ref state, typeInfo);
88
private static
JsonSchema
MapJsonSchemaCore(
101
KeyValuePair<string,
JsonSchema
>? typeDiscriminator = null,
115
JsonSchema
schema;
122
return CompleteSchema(ref state,
JsonSchema
.CreateTrueSchema());
142
List<
JsonSchema
>? anyOf = new(derivedTypes.Count);
150
KeyValuePair<string,
JsonSchema
>? derivedTypeDiscriminator = null;
159
JsonSchema
discriminatorSchema = new() { Constant = discriminatorNode };
166
JsonSchema
derivedSchema = MapJsonSchemaCore(
196
foreach (
JsonSchema
derivedSchema in anyOf)
240
List<KeyValuePair<string,
JsonSchema
>>? properties = null;
242
JsonSchema
? additionalProperties = null;
248
additionalProperties =
JsonSchema
.CreateFalseSchema();
308
JsonSchema
propertySchema = MapJsonSchemaCore(
323
JsonSchema
.EnsureMutable(ref propertySchema);
352
JsonSchema
items = MapJsonSchemaCore(ref state, elementTypeInfo, customNumberHandling: effectiveNumberHandling);
373
JsonSchema
items = MapJsonSchemaCore(ref state, elementTypeInfo, customNumberHandling: effectiveNumberHandling);
400
List<KeyValuePair<string,
JsonSchema
>>? dictProps = null;
414
JsonSchema
valueSchema = MapJsonSchemaCore(ref state, valueTypeInfo, customNumberHandling: effectiveNumberHandling);
428
if (_simpleTypeSchemaFactories.TryGetValue(typeInfo.Type, out Func<JsonNumberHandling,
JsonSchema
>? simpleTypeSchemaFactory))
438
schema =
JsonSchema
.CreateTrueSchema();
444
JsonSchema
CompleteSchema(ref GenerationState state,
JsonSchema
schema)
579
private 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(),
637
private static
JsonSchema
GetSchemaForNumericType(JsonSchemaType schemaType, JsonNumberHandling numberHandling, bool isIeeeFloatingPoint = false)
730
private static
JsonSchema
GetEnumConverterSchema(JsonTypeInfo typeInfo, JsonConverter converter)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.JsonSchema.cs (16)
20
public static
JsonSchema
CreateFalseSchema() => new(false);
21
public static
JsonSchema
CreateTrueSchema() => new(true);
144
public List<KeyValuePair<string,
JsonSchema
>>? Properties
154
private List<KeyValuePair<string,
JsonSchema
>>? _properties;
168
public
JsonSchema
? Items
178
private
JsonSchema
? _items;
180
public
JsonSchema
? AdditionalProperties
190
private
JsonSchema
? _additionalProperties;
204
public
JsonSchema
? Not
214
private
JsonSchema
? _not;
216
public List<
JsonSchema
>? AnyOf
226
private List<
JsonSchema
>? _anyOf;
384
foreach (KeyValuePair<string,
JsonSchema
> property in Properties)
426
foreach (
JsonSchema
schema in AnyOf)
465
public static void EnsureMutable(ref
JsonSchema
schema)
470
schema = new JsonSchema { Not =
JsonSchema
.CreateTrueSchema() };