AIJsonUtilities.CreateJsonSchema Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a JSON schema for the specified type.
public static System.Text.Json.JsonElement CreateJsonSchema (Type? type, string? description = default, bool hasDefaultValue = false, object? defaultValue = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default, Microsoft.Extensions.AI.AIJsonSchemaCreateOptions? inferenceOptions = default);
static member CreateJsonSchema : Type * string * bool * obj * System.Text.Json.JsonSerializerOptions * Microsoft.Extensions.AI.AIJsonSchemaCreateOptions -> System.Text.Json.JsonElement
Public Function CreateJsonSchema (type As Type, Optional description As String = Nothing, Optional hasDefaultValue As Boolean = false, Optional defaultValue As Object = Nothing, Optional serializerOptions As JsonSerializerOptions = Nothing, Optional inferenceOptions As AIJsonSchemaCreateOptions = Nothing) As JsonElement
Parameters
- type
- Type
The type for which to generate the schema.
- description
- String
The description of the parameter.
- hasDefaultValue
- Boolean
true
if the parameter is optional; otherwise, false
.
- defaultValue
- Object
The default value of the optional parameter, if applicable.
- serializerOptions
- JsonSerializerOptions
The options used to extract the schema from the specified type.
- inferenceOptions
- AIJsonSchemaCreateOptions
The options controlling schema inference.
Returns
A JsonElement representing the schema.
Remarks
Uses a cache keyed on the serializerOptions
to store schema result, unless a TransformSchemaNode delegate has been specified.