OasSchema

The OasSchema object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the [JSON Schema Specification Wright Draft 00](https://json-schema.org/).

For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). Unless stated otherwise, the property definitions follow the JSON Schema.

Properties

The following properties are taken directly from the JSON Schema definition and follow the same specifications: - title - multipleOf - maximum - exclusiveMaximum - minimum - exclusiveMinimum - maxLength - minLength - pattern (This string SHOULD be a valid regular expression, according to the Ecma-262 Edition 5.1 regular expression dialect) - maxItems - minItems - uniqueItems - maxProperties - minProperties - required - enum

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification:

- type - Value MUST be a string. Multiple types via an array are not supported. - allOf - Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. - oneOf - Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. - anyOf - Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. - not - Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. - items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. items MUST be present if the type is array. - properties - Property definitions MUST be a OasSchema object and not a standard JSON Schema (inline or referenced). - additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a OasSchema object and not a standard JSON Schema. Consistent with JSON Schema, additionalProperties defaults to true. - description - CommonMark syntax MAY be used for rich text representation. - format - See Data Type Formats for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. - default - 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 OasSchema object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.

Alternatively, any time a OasSchema object can be used, a OasReference object can be used in its place. This allows referencing definitions instead of defining them inline.

Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

Members

Variables

additionalProperties
Json additionalProperties;

The value of "additionalProperties" MUST be a boolean or a schema.

allOf
OasSchema[] allOf;

This keyword's value MUST be an array. This array MUST have at least one element.

anyOf
OasSchema[] anyOf;

This keyword's value MUST be an array. This array MUST have at least one element.

description
string description;

Both of these keywords can be used to decorate a user interface with information about the data produced by this user interface. A title will preferrably be short, whereas a description will provide explanation about the purpose of the instance described by this schema.

discriminator
OasDiscriminator 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. See Composition and Inheritance for more details.

enum_
Json[] enum_;

The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.

format
string format;

Structural validation alone may be insufficient to validate that an instance meets all the requirements of an application. The "format" keyword is defined to allow interoperable semantic validation for a fixed subset of values which are accurately described by authoritative resources, be they RFCs or other external specifications.

items
OasSchema items;

If present, a schema that validates items of an array

not
OasSchema not;

This keyword's value MUST be an object. This object MUST be a valid JSON Schema.

nullable
bool nullable;

A true value adds "null" to the allowed type specified by the type keyword, only if type is explicitly defined within the same OasSchema object. Other OasSchema object constraints retain their defined behavior, and therefore may disallow the use of null as a value. A false value leaves the specified or default type unmodified. The default value is false.

oneOf
OasSchema[] oneOf;

This keyword's value MUST be an array. This array MUST have at least one element.

properties
OasSchema[string] properties;

An mapping from an object property name to a schemas that property must be validated against.

readOnly
bool 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.

ref_
string ref_;

An internal or external reference to a schema component. If set, the other attribute are unused.

required
string[] required;

The value of this keyword MUST be an array. This array MUST have at least one element. Elements of this array MUST be strings, and MUST be unique.

title
string title;

Both of these keywords can be used to decorate a user interface with information about the data produced by this user interface. A title will preferrably be short, whereas a description will provide explanation about the purpose of the instance described by this schema.

type
string type;

Value MUST be a string. Multiple types via an array are not supported.

writeOnly
bool 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.

Meta