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

JsonSchemaGenerator

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

Gets the settings.

Initializes a new instance of the JsonSchemaGenerator class.

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

Applies the property annotations to the JSON property.

public virtual object ConvertDefaultValue(ContextualType type, object defaultValue)

Gets the actual default value for the given object (e.g. correctly converts enums).

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

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

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

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

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

public Task<JsonSchema> GenerateAsync(ContextualType contextualType, JsonSchemaResolver schemaResolver)

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

public Task<TSchemaType> GenerateAsync<TSchemaType>(ContextualType contextualType, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema

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

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

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

public virtual Task GenerateAsync<TSchemaType>(ContextualType contextualType, TSchemaType schema, JsonSchemaResolver schemaResolver) where TSchemaType : JsonSchema

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

protected virtual Task GenerateObjectAsync(Type type, JsonTypeDescription typeDescription, JsonSchema schema, JsonSchemaResolver schemaResolver)

Generates the properties for the given type and schema.

public Task<TSchemaType> GenerateWithReferenceAndNullabilityAsync<TSchemaType>(ContextualType contextualType, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema, Task> transformation = null) where TSchemaType : JsonSchema

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>(ContextualType contextualType, bool isNullable, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema, Task> transformation = null) where TSchemaType : JsonSchema

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

public Task<TSchemaType> GenerateWithReferenceAsync<TSchemaType>(ContextualType contextualType, JsonSchemaResolver schemaResolver, Func<TSchemaType, JsonSchema, Task> transformation = null) where TSchemaType : JsonSchema

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

public virtual string GetPropertyName(JsonProperty jsonProperty, 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.