Home JsonSchemaBuilderExtensions Class
JsonSchemaBuilderExtensions Class
Cancel

JsonSchemaBuilderExtensions Class

Namespace: Json.Schema.OpenApi

Inheritance: JsonSchemaBuilderExtensions 🡒 object

Provides a fluent interface for Json.Schema.JsonSchemaBuilder.

Methods

Discriminator(this JsonSchemaBuilder builder, string propertyName, IReadOnlyDictionary<string, string> mapping, IReadOnlyDictionary<string, JsonNode> extensions)

Adds a discriminator keyword.

Declaration

1
public static JsonSchemaBuilder Discriminator(this JsonSchemaBuilder builder, string propertyName, IReadOnlyDictionary<string, string> mapping, IReadOnlyDictionary<string, JsonNode> extensions)
ParameterTypeDescription
builderJsonSchemaBuilderThe builder.
propertyNamestringThe name of the property in the payload that will hold the discriminator value.
mappingIReadOnlyDictionary<string, string>An object to hold mappings between payload values and schema names or references.
extensionsIReadOnlyDictionary<string, JsonNode>Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. Field names beginning x-oai- and x-oas- are reserved for uses defined by the OpenAPI Initiative. The value can be null, a primitive, an array or an object.

Returns

The builder.

Example(this JsonSchemaBuilder builder, JsonNode value)

Adds an example keyword.

Declaration

1
public static JsonSchemaBuilder Example(this JsonSchemaBuilder builder, JsonNode value)
ParameterTypeDescription
builderJsonSchemaBuilderThe builder.
valueJsonNodeThe example value.

Returns

The builder.

ExternalDocs(this JsonSchemaBuilder builder, Uri url, string description, IReadOnlyDictionary<string, JsonNode> extensions)

Adds an externalDocs keyword.

Declaration

1
public static JsonSchemaBuilder ExternalDocs(this JsonSchemaBuilder builder, Uri url, string description, IReadOnlyDictionary<string, JsonNode> extensions)
ParameterTypeDescription
builderJsonSchemaBuilderThe builder.
urlUriThe URL for the target documentation. This MUST be in the form of a URL.
descriptionstringA description of the target documentation. CommonMark syntax MAY be used for rich text representation.
extensionsIReadOnlyDictionary<string, JsonNode>Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. Field names beginning x-oai- and x-oas- are reserved for uses defined by the OpenAPI Initiative. The value can be null, a primitive, an array or an object.

Returns

The builder.

Xml(this JsonSchemaBuilder builder, Uri namespace, string name, string prefix, bool? attribute, bool? wrapped, IReadOnlyDictionary<string, JsonNode> extensions)

Adds an xml keyword to the schema.

Declaration

1
public static JsonSchemaBuilder Xml(this JsonSchemaBuilder builder, Uri namespace, string name, string prefix, bool? attribute, bool? wrapped, IReadOnlyDictionary<string, JsonNode> extensions)
ParameterTypeDescription
builderJsonSchemaBuilderThe builder.
namespaceUriThe URI of the namespace definition. This MUST be in the form of an absolute URI.
namestringReplaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being array (outside the items), it will affect the wrapping element and
prefixstringThe prefix to be used for the name.
attributebool?Declares whether the property definition translates to an attribute instead of an
wrappedbool?MAY be used only for an array definition. Signifies whether the array is wrapped (for example, \<books\>\<book /\>\<book /\>\</books\>) or unwrapped (\<book /\>\<book /\>). Default value is false. The definition takes effect only when defined alongside type
extensionsIReadOnlyDictionary<string, JsonNode>Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. Field names beginning x-oai- and x-oas- are reserved for uses defined by the OpenAPI Initiative. The value can be null, a primitive, an array or an object.

Returns

The builder.

Contents