Skip to main content

Class: EnumSchema

protoc_gen_openapiv2.options.EnumSchema

EnumSchema is subset of fields from the OpenAPI v2 specification's Schema object. Only fields that are applicable to Enums are included See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject

Example:

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_enum) = { ... title: "MyEnum"; description:"This is my nice enum"; example: "ZERO"; required: true; ... };

Implements

Constructors

constructor

new EnumSchema(properties?): EnumSchema

Constructs a new EnumSchema.

Parameters

NameTypeDescription
properties?IEnumSchemaProperties to set

Returns

EnumSchema

Properties

default

default: string

EnumSchema default.

Implementation of

IEnumSchema.default


description

description: string

A short description of the schema.

Implementation of

IEnumSchema.description


example

example: string

EnumSchema example.

Implementation of

IEnumSchema.example


extensions

extensions: Object

Custom properties that start with "x-" such as "x-foo" used to describe extra functionality that is not covered by the standard OpenAPI Specification. See: https://swagger.io/docs/specification/2-0/swagger-extensions/

Index signature

▪ [k: string]: IValue

Implementation of

IEnumSchema.extensions


externalDocs

Optional externalDocs: null | IExternalDocumentation

Additional external documentation for this schema.

Implementation of

IEnumSchema.externalDocs


readOnly

readOnly: boolean

EnumSchema readOnly.

Implementation of

IEnumSchema.readOnly


ref

ref: string

Ref is used to define an external reference to include in the message. This could be a fully qualified proto message reference, and that type must be imported into the protofile. If no message is identified, the Ref will be used verbatim in the output. For example: ref: ".google.protobuf.Timestamp".

Implementation of

IEnumSchema.ref


required

required: boolean

EnumSchema required.

Implementation of

IEnumSchema.required


title

title: string

The title of the schema.

Implementation of

IEnumSchema.title

Methods

toJSON

toJSON(): Object

Converts this EnumSchema to JSON.

Returns

Object

JSON object


create

create(properties?): EnumSchema

Creates a new EnumSchema instance using the specified properties.

Parameters

NameTypeDescription
properties?IEnumSchemaProperties to set

Returns

EnumSchema

EnumSchema instance


decode

decode(reader, length?): EnumSchema

Decodes an EnumSchema message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

EnumSchema

EnumSchema

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): EnumSchema

Decodes an EnumSchema message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

EnumSchema

EnumSchema

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified EnumSchema message. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.EnumSchema.verify|verify messages.

Parameters

NameTypeDescription
messageIEnumSchemaEnumSchema message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified EnumSchema message, length delimited. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.EnumSchema.verify|verify messages.

Parameters

NameTypeDescription
messageIEnumSchemaEnumSchema message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): EnumSchema

Creates an EnumSchema message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

EnumSchema

EnumSchema


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for EnumSchema

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toObject

toObject(message, options?): Object

Creates a plain object from an EnumSchema message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageEnumSchemaEnumSchema
options?IConversionOptionsConversion options

Returns

Object

Plain object