JsonSchemaExporter.GetJsonSchemaAsNode Method
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.
GetJsonSchemaAsNode(JsonTypeInfo, JsonSchemaExporterOptions) |
Generates a JSON schema corresponding to the specified contract metadata. |
GetJsonSchemaAsNode(JsonSerializerOptions, Type, JsonSchemaExporterOptions) |
Generates a JSON schema corresponding to the contract metadata of the specified type. |
- Source:
- JsonSchemaExporter.cs
Generates a JSON schema corresponding to the specified contract metadata.
public static System.Text.Json.Nodes.JsonNode GetJsonSchemaAsNode (this System.Text.Json.Serialization.Metadata.JsonTypeInfo typeInfo, System.Text.Json.Schema.JsonSchemaExporterOptions? exporterOptions = default);
static member GetJsonSchemaAsNode : System.Text.Json.Serialization.Metadata.JsonTypeInfo * System.Text.Json.Schema.JsonSchemaExporterOptions -> System.Text.Json.Nodes.JsonNode
<Extension()>
Public Function GetJsonSchemaAsNode (typeInfo As JsonTypeInfo, Optional exporterOptions As JsonSchemaExporterOptions = Nothing) As JsonNode
Parameters
- typeInfo
- JsonTypeInfo
The contract metadata for which to generate the schema.
- exporterOptions
- JsonSchemaExporterOptions
The exporterOptions object controlling the schema generation.
Returns
A new JsonNode instance defining the JSON schema for typeInfo
.
Exceptions
One of the specified parameters is null
.
The typeInfo
parameter contains unsupported exporterOptions.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
- Source:
- JsonSchemaExporter.cs
Generates a JSON schema corresponding to the contract metadata of the specified type.
public static System.Text.Json.Nodes.JsonNode GetJsonSchemaAsNode (this System.Text.Json.JsonSerializerOptions options, Type type, System.Text.Json.Schema.JsonSchemaExporterOptions? exporterOptions = default);
static member GetJsonSchemaAsNode : System.Text.Json.JsonSerializerOptions * Type * System.Text.Json.Schema.JsonSchemaExporterOptions -> System.Text.Json.Nodes.JsonNode
<Extension()>
Public Function GetJsonSchemaAsNode (options As JsonSerializerOptions, type As Type, Optional exporterOptions As JsonSchemaExporterOptions = Nothing) As JsonNode
Parameters
- options
- JsonSerializerOptions
The options instance from which to resolve the contract metadata.
- type
- Type
The root type for which to generate the JSON schema.
- exporterOptions
- JsonSchemaExporterOptions
The exporterOptions object controlling the schema generation.
Returns
A new JsonNode instance defining the JSON schema for type
.
Exceptions
One of the specified parameters is null
.
The options
parameter contains unsupported exporterOptions.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: