OpenApiSchema Class

Definition

Schema Object.

public class OpenApiSchema : Microsoft.OpenApi.Interfaces.IEffective<Microsoft.OpenApi.Models.OpenApiSchema>, Microsoft.OpenApi.Interfaces.IOpenApiExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable
type OpenApiSchema = class
    interface IOpenApiSerializable
    interface IOpenApiElement
    interface IOpenApiReferenceable
    interface IEffective<OpenApiSchema>
    interface IOpenApiExtensible
Public Class OpenApiSchema
Implements IEffective(Of OpenApiSchema), IOpenApiExtensible, IOpenApiReferenceable
Inheritance
OpenApiSchema
Implements

Constructors

OpenApiSchema()

Parameterless constructor

OpenApiSchema(OpenApiSchema)

Initializes a copy of OpenApiSchema object

Properties

AdditionalProperties

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

AdditionalPropertiesAllowed

Indicates if the schema can contain properties other than those defined by the properties map.

AllOf

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

AnyOf

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Default

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.

Deprecated

Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.

Description

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 CommonMark syntax MAY be used for rich text representation.

Discriminator

Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description.

Enum

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

Example

A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.

ExclusiveMaximum

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

ExclusiveMinimum

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

Extensions

This object MAY be extended with Specification Extensions.

ExternalDocs

Additional external documentation for this schema.

Format

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.

Items

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.

Maximum

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MaxItems

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MaxLength

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MaxProperties

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

Minimum

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MinItems

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MinLength

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MinProperties

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

MultipleOf

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

Not

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Nullable

Allows sending a null value for the defined schema. Default value is false.

OneOf

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Pattern

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect

Properties

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).

ReadOnly

Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.

Reference

Reference object.

Required

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

Title

Follow JSON Schema definition. Short text providing information about the data.

Type

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 Value MUST be a string. Multiple types via an array are not supported.

UniqueItems

Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00

UnresolvedReference

Indicates object is a placeholder reference to an actual object and does not contain valid data.

WriteOnly

Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.

Xml

This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.

Methods

GetEffective(OpenApiDocument)

Returns an effective OpenApiSchema object based on the presence of a $ref

SerializeAsV2(IOpenApiWriter)

Serialize OpenApiSchema to Open Api v2.0

SerializeAsV2WithoutReference(IOpenApiWriter)

Serialize to OpenAPI V2 document without using reference.

SerializeAsV3(IOpenApiWriter)

Serialize OpenApiSchema to Open Api v3.0

SerializeAsV3WithoutReference(IOpenApiWriter)

Serialize to OpenAPI V3 document without using reference.

Extension Methods

Validate(IOpenApiElement, ValidationRuleSet)

Validate element and all child elements

ResolveReference(IOpenApiReferenceable, JsonPointer)

Resolves a JSON Pointer with respect to an element, returning the referenced element.

MapOpenApiPrimitiveTypeToSimpleType(OpenApiSchema)

Maps an OpenAPI data type and format to a simple type.

Applies to