Share via


OpenApiExample Class

Definition

Example Object.

public class OpenApiExample : Microsoft.OpenApi.IOpenApiExample, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IShallowCopyable<Microsoft.OpenApi.IOpenApiExample>
type OpenApiExample = class
    interface IOpenApiExtensible
    interface IOpenApiElement
    interface IOpenApiExample
    interface IOpenApiDescribedElement
    interface IOpenApiSummarizedElement
    interface IOpenApiReadOnlyExtensible
    interface IShallowCopyable<IOpenApiExample>
    interface IOpenApiReferenceable
    interface IOpenApiSerializable
Public Class OpenApiExample
Implements IOpenApiExample, IOpenApiExtensible, IShallowCopyable(Of IOpenApiExample)
Inheritance
OpenApiExample
Implements

Constructors

Name Description
OpenApiExample()

Parameter-less constructor

Properties

Name Description
DataValue

Embedded literal example value. The dataValue property and the value property are mutually exclusive. To represent examples of media types that cannot be naturally represented in JSON or YAML, use a string value to contain the example with escaping where necessary. Available in OpenAPI 3.2+, serialized as extension in 3.1 and earlier.

Description

Long description for the example. CommonMark syntax MAY be used for rich text representation.

Extensions

Specification extensions.

ExternalValue

A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.

SerializedValue

A string representation of the example. This is mutually exclusive with the value and dataValue properties. Available in OpenAPI 3.2+, serialized as extension in 3.1 and earlier.

Summary

Short description for the example.

Value

Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, 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.

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
Validate(IOpenApiElement, ValidationRuleSet)

Validate element and all child elements

Applies to