OpenApiSchema Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The Schema Object allows the definition of input and output data types.
public class OpenApiSchema : Microsoft.OpenApi.IMetadataContainer, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiSchema, Microsoft.OpenApi.IShallowCopyable<Microsoft.OpenApi.IOpenApiSchema>
type OpenApiSchema = class
interface IOpenApiExtensible
interface IOpenApiElement
interface IOpenApiSchema
interface IOpenApiDescribedElement
interface IOpenApiReadOnlyExtensible
interface IShallowCopyable<IOpenApiSchema>
interface IOpenApiReferenceable
interface IOpenApiSerializable
interface IMetadataContainer
Public Class OpenApiSchema
Implements IMetadataContainer, IOpenApiExtensible, IOpenApiSchema, IShallowCopyable(Of IOpenApiSchema)
- Inheritance
-
OpenApiSchema
- Implements
Constructors
| Name | Description |
|---|---|
| OpenApiSchema() |
Parameterless constructor |
Properties
| Name | Description |
|---|---|
| AdditionalProperties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation 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://json-schema.org/draft/2020-12/json-schema-validation Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. |
| AnyOf |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. |
| Comment |
$comment - reserves a location for comments from schema authors to readers or maintainers of the schema. |
| Const |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| Default |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation 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. You must use the IsJsonNullSentinel(JsonNode) method to check whether Default was assigned a null value in the document. Assign JsonNull to use get null as a serialized value. |
| Definitions |
$defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema. The keyword does not directly affect the validation result |
| DependentRequired |
Follow JSON Schema definition:https://json-schema.org/draft/2020-12/json-schema-validation#section-6.5.4 |
| Deprecated |
Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. |
| Description |
Long description for the example. 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. |
| DynamicAnchor |
$dynamicAnchor - used to create plain name fragments that are not tied to any particular structural location for referencing purposes, which are taken into consideration for dynamic referencing. |
| DynamicRef |
$dynamicRef - an applicator that allows for deferring the full resolution until runtime, at which point it is resolved each time it is encountered while evaluating an instance |
| Enum |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| 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. You must use the IsJsonNullSentinel(JsonNode) method to check whether Default was assigned a null value in the document. Assign JsonNull to use get null as a serialized value. |
| Examples |
A free-form property to include examples of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a list of values can be used to contain the examples with escaping where necessary. |
| ExclusiveMaximum |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| ExclusiveMinimum |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| Extensions |
Specification extensions. |
| ExternalDocs |
Additional external documentation for this schema. |
| Format |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. |
| Id |
$id - Identifies a schema resource with its canonical URI. |
| Items |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation 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://json-schema.org/draft/2020-12/json-schema-validation |
| MaxItems |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MaxLength |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MaxProperties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| Metadata |
A collection of properties associated with the current OpenAPI element to be used by the application. Metadata are NOT (de)serialized with the schema and can be used for custom properties. |
| Minimum |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MinItems |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MinLength |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MinProperties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| MultipleOf |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| Not |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. |
| OneOf |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. |
| Pattern |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect |
| PatternProperties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation PatternProperty definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced) Each property name of this object SHOULD be a valid regular expression according to the ECMA 262 r egular expression dialect. Each property value of this object MUST be an object, and each object MUST be a valid Schema Object not a standard JSON Schema. |
| Properties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation 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. |
| Required |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| Schema |
$schema, a JSON Schema dialect identifier. Value must be a URI |
| Title |
Follow JSON Schema definition. Short text providing information about the data. |
| Type |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation Value MUST be a string in V2 and V3. |
| UnevaluatedProperties |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| UniqueItems |
Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation |
| UnrecognizedKeywords |
This object stores any unrecognized keywords found in the schema. |
| Vocabulary |
$vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema. |
| 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
| Name | Description |
|---|---|
| CreateShallowCopy() |
Create a shallow copy of the current instance. |
| SerializeAsV2(IOpenApiWriter) |
Serialize Open API element to v2.0. |
| SerializeAsV3(IOpenApiWriter) |
Serialize Open API element to v3.0. |
| SerializeAsV31(IOpenApiWriter) |
Serialize OpenAPI element into v3.1 |
| SerializeAsV32(IOpenApiWriter) |
Serialize OpenAPI element into v3.2 |
Extension Methods
| Name | Description |
|---|---|
| MapOpenApiPrimitiveTypeToSimpleType(OpenApiSchema) |
Maps a JsonSchema data type and format to a simple type. |
| Validate(IOpenApiElement, ValidationRuleSet) |
Validate element and all child elements |