Home ValidatingJsonConverter Class
ValidatingJsonConverter Class
Cancel

ValidatingJsonConverter Class

Namespace: Json.Schema.Serialization

Inheritance: ValidatingJsonConverter 🡒 JsonConverterFactory 🡒 JsonConverter 🡒 object

Adds schema validation for types decorated with the Json.Schema.Serialization.JsonSchemaAttribute.

Properties

NameTypeSummary
OutputFormatOutputFormat?Specifies the output format.
RequireFormatValidationbool?Specifies whether the format keyword should be required to provide validation results. Default is false, which just produces annotations for drafts 2019-09 and prior or follows the behavior set forth by the format-annotation vocabulary requirement in the $vocabulary keyword in a meta-schema declaring draft 2020-12.
TypeType 

Methods

CanConvert(Type typeToConvert)

When overridden in a derived class, determines whether the converter instance can convert the specified object type.

Declaration

1
public override bool CanConvert(Type typeToConvert)
ParameterTypeDescription
typeToConvertTypeThe type of the object to check whether it can be converted by this converter instance.

Returns

if the instance can convert the specified object type; otherwise, .

CreateConverter(Type typeToConvert, JsonSerializerOptions options)

Creates a converter for a specified type.

Declaration

1
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
ParameterTypeDescription
typeToConvertTypeThe type handled by the converter.
optionsJsonSerializerOptionsThe serialization options to use.

Returns

An instance of a System.Text.Json.Serialization.JsonConverter1** where T` is compatible with. If is returned, a **System.NotSupportedException will be thrown.

MapType(JsonSchema schema)

Adds an explicit type/schema mapping for types external types which cannot be decorated with Json.Schema.Serialization.JsonSchemaAttribute.

Declaration

1
public static void MapType(JsonSchema schema)
ParameterTypeDescription
schemaJsonSchema 
Contents