OpenApiSchemaReference Class

Definition

Schema reference object

public class OpenApiSchemaReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder<Microsoft.OpenApi.OpenApiSchema,Microsoft.OpenApi.IOpenApiSchema,Microsoft.OpenApi.JsonSchemaReference>, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiSchema, Microsoft.OpenApi.IOpenApiSchemaMissingProperties, Microsoft.OpenApi.IOpenApiSchemaWithUnevaluatedProperties, Microsoft.OpenApi.IShallowCopyable<Microsoft.OpenApi.IOpenApiSchema>
type OpenApiSchemaReference = class
    inherit BaseOpenApiReferenceHolder<OpenApiSchema, IOpenApiSchema, JsonSchemaReference>
    interface IOpenApiSchema
    interface IOpenApiDescribedElement
    interface IOpenApiElement
    interface IOpenApiReadOnlyExtensible
    interface IShallowCopyable<IOpenApiSchema>
    interface IOpenApiReferenceable
    interface IOpenApiSerializable
    interface IOpenApiSchemaMissingProperties
    interface IOpenApiSchemaWithUnevaluatedProperties
    interface IOpenApiExtensible
Public Class OpenApiSchemaReference
Inherits BaseOpenApiReferenceHolder(Of OpenApiSchema, IOpenApiSchema, JsonSchemaReference)
Implements IOpenApiExtensible, IOpenApiSchema, IOpenApiSchemaMissingProperties, IOpenApiSchemaWithUnevaluatedProperties, IShallowCopyable(Of IOpenApiSchema)
Inheritance
Implements

Constructors

Name Description
OpenApiSchemaReference(String, OpenApiDocument, String)

Constructor initializing the reference object.

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.

Anchor

$anchor - identifies a plain-name location-independent fragment within the schema resource. Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-anchor

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

Contains

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-contains An array instance is valid against "contains" if at least one of its elements is valid against this schema. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

ContentEncoding

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation#name-contentencoding contentEncoding - identifies the encoding of string content.

ContentMediaType

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation#name-contentmediatype contentMediaType - identifies the media type of string content.

ContentSchema

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation#name-contentschema contentSchema - provides a schema that describes the decoded string content.

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

DependentSchemas

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-dependentschemas dependentSchemas - maps property names to schemas that are applied when that property is present.

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

Else

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-else else - applies when If does not evaluate successfully.

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.

If

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-if if - applies a conditional schema that determines whether Then or Else should be evaluated.

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.

MaxContains

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation The number of elements matching the "contains" schema MUST be less than or equal to this value.

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

MinContains

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation The number of elements matching the "contains" schema MUST be greater than or equal to this value.

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).

PropertyNames

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-propertynames propertyNames - provides a schema that validates property names.

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.

RecursiveTarget

Gets the recursively resolved target object.

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
Reference

Reference object.

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
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

Target

Gets the resolved target object.

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
Then

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-then then - applies when If evaluates successfully.

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

Indicates whether unevaluated properties are allowed. When false, no unevaluated properties are permitted. Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-unevaluatedproperties Only serialized when false and UnevaluatedPropertiesSchema (from IOpenApiSchemaMissingProperties) is null.

UnevaluatedPropertiesSchema

Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-unevaluatedproperties This is a schema that unevaluated properties must validate against. When serialized, this takes precedence over the UnevaluatedProperties boolean property.

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.

UnresolvedReference

Indicates if object is populated with data or is just a reference to the data

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
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
CopyReference(JsonSchemaReference)

Copy the reference as a target element with overrides.

CopyReference(V)

Copy the reference as a target element with overrides.

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
CopyReferenceAsTargetElementWithOverrides(IOpenApiSchema)

Copy the reference as a target element with overrides.

CopyReferenceAsTargetElementWithOverrides(U)

Copy the reference as a target element with overrides.

(Inherited from BaseOpenApiReferenceHolder<T,U,V>)
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
Validate(IOpenApiElement, ValidationRuleSet)

Validate element and all child elements

Applies to