<PackageReference Include="NJsonSchema" Version="9.10.71" />

JsonSchemaGenerator

public class JsonSchemaGenerator
Generates a JsonSchema4 object for a given type.

Gets the settings.

Initializes a new instance of the JsonSchemaGenerator class.

public virtual void ApplyDataAnnotations(JsonSchema4 schema, JsonTypeDescription typeDescription, IEnumerable<Attribute> parentAttributes)

Applies the property annotations to the JSON property.

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

public Task<JsonSchema4> GenerateAsync(Type type, JsonSchemaResolver schemaResolver)

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

public Task<TSchemaType> GenerateAsync<TSchemaType>(Type type, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema4

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

public Task<JsonSchema4> GenerateAsync(Type type, IEnumerable<Attribute> parentAttributes, JsonSchemaResolver schemaResolver)

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

public Task<TSchemaType> GenerateAsync<TSchemaType>(Type type, IEnumerable<Attribute> parentAttributes, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema4

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

public virtual Task GenerateAsync<TSchemaType>(Type type, IEnumerable<Attribute> parentAttributes, TSchemaType schema, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema4

Generates a JsonSchema4 object for the given type and adds the mapping to the given resolver.

protected virtual Task GenerateObjectAsync<TSchemaType>(Type type, TSchemaType schema, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema4

Generates the properties for the given type and schema.

public Task<TSchemaType> GenerateWithReferenceAndNullabilityAsync<TSchemaType>(Type type, IEnumerable<Attribute> parentAttributes, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema4, Task> transformation = null) where TSchemaType : JsonSchema4

Generetes a schema directly or referenced for the requested schema type; also adds nullability if required by looking at the type's JsonTypeDescription.

public virtual Task<TSchemaType> GenerateWithReferenceAndNullabilityAsync<TSchemaType>(Type type, IEnumerable<Attribute> parentAttributes, bool isNullable, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema4, Task> transformation = null) where TSchemaType : JsonSchema4

Generetes a schema directly or referenced for the requested schema type; also adds nullability if required.

public Task<TSchemaType> GenerateWithReferenceAsync<TSchemaType>(Type type, IEnumerable<Attribute> parentAttributes, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema4, Task> transformation = null) where TSchemaType : JsonSchema4

Generetes a schema directly or referenced for the requested schema type; does NOT change nullability.

public virtual string GetPropertyName(JsonProperty property, MemberInfo memberInfo)

Gets the converted property name.

protected virtual string[] GetTypeProperties(Type type)

Gets the properties of the given type or null to take all properties.