Share via


JsonSchemaReference Class

Definition

Schema reference information that includes metadata annotations from JSON Schema 2020-12. This class extends OpenApiReference to provide schema-specific metadata override capabilities.

public class JsonSchemaReference : Microsoft.OpenApi.OpenApiReferenceWithDescription
type JsonSchemaReference = class
    inherit OpenApiReferenceWithDescription
Public Class JsonSchemaReference
Inherits OpenApiReferenceWithDescription
Inheritance

Constructors

Name Description
JsonSchemaReference()

Parameterless constructor

JsonSchemaReference(JsonSchemaReference)

Initializes a copy instance of the JsonSchemaReference object

Properties

Name Description
Default

A default value which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a default field, then this field has no effect. 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.

Deprecated

Indicates whether the referenced component is deprecated. If the referenced object-type does not allow a deprecated field, then this field has no effect.

Description

A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect.

(Inherited from OpenApiReferenceWithDescription)
Examples

Example values which by default SHOULD override those of the referenced component. If the referenced object-type does not allow examples, then this field has no effect.

ExternalResource

External resource in the reference. It maybe:

  1. a absolute/relative file path, for example: ../commons/pet.json
  2. a Url, for example: http://localhost/pet.json
(Inherited from BaseOpenApiReference)
HostDocument

The OpenApiDocument that is hosting the OpenApiReference instance. This is used to enable dereferencing the reference.

(Inherited from BaseOpenApiReference)
Id

The identifier of the reusable component of one particular ReferenceType. If ExternalResource is present, this is the path to the component after the '#/'. For example, if the reference is 'example.json#/path/to/component', the Id is 'path/to/component'. If ExternalResource is not present, this is the name of the component without the reference type name. For example, if the reference is '#/components/schemas/componentName', the Id is 'componentName'.

(Inherited from BaseOpenApiReference)
IsExternal

Gets a flag indicating whether this reference is an external reference.

(Inherited from BaseOpenApiReference)
IsFragment

Gets a flag indicating whether a file is a valid OpenAPI document or a fragment

(Inherited from BaseOpenApiReference)
IsLocal

Gets a flag indicating whether this reference is a local reference.

(Inherited from BaseOpenApiReference)
ReadOnly

Indicates whether the referenced component is read-only. If the referenced object-type does not allow a readOnly field, then this field has no effect.

ReferenceV2

Gets the full reference string for V2.0

(Inherited from BaseOpenApiReference)
ReferenceV3

Gets the full reference string for v3.0.

(Inherited from BaseOpenApiReference)
Title

A title which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a title field, then this field has no effect.

Type

The element type referenced.

(Inherited from BaseOpenApiReference)
WriteOnly

Indicates whether the referenced component is write-only. If the referenced object-type does not allow a writeOnly field, then this field has no effect.

Methods

Name Description
SerializeAdditionalV31Properties(IOpenApiWriter)

Serialize additional properties for Open Api v3.1.

SerializeAdditionalV32Properties(IOpenApiWriter)

Serialize additional properties for Open Api v3.2.

SerializeAsV2(IOpenApiWriter)

Serialize Open API element to v2.0.

(Inherited from BaseOpenApiReference)
SerializeAsV3(IOpenApiWriter)

Serialize Open API element to v3.0.

(Inherited from BaseOpenApiReference)
SerializeAsV31(IOpenApiWriter)

Serialize OpenAPI element into v3.1

(Inherited from BaseOpenApiReference)
SerializeAsV32(IOpenApiWriter)

Serialize OpenAPI element into v3.2

(Inherited from BaseOpenApiReference)
SetAdditional31MetadataFromMapNode(JsonObject)

Sets additional metadata from the map node.

Extension Methods

Name Description
Validate(IOpenApiElement, ValidationRuleSet)

Validate element and all child elements

Applies to