Skip to main content

Class: 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; ... };

Properties​

default​

default: string

EnumSchema default.


description​

description: string

A short description of the schema.


example​

example: string

EnumSchema 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]: $Properties


externalDocs?​

optional externalDocs?: $Properties | null

Additional external documentation for this schema.


readOnly​

readOnly: boolean

EnumSchema 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".


required​

required: boolean

EnumSchema required.


title​

title: string

The title of the schema.

Methods​

toJSON()​

toJSON(): object

Converts this EnumSchema to JSON.

Returns​

object

JSON object


create()​

Call Signature​

static create(properties?): EnumSchema & $Shape

Creates a new EnumSchema instance using the specified properties.

Parameters​
properties?​

$Shape

Properties to set

Returns​

EnumSchema & $Shape

EnumSchema instance

Call Signature​

static create(properties?): EnumSchema

Creates a new EnumSchema instance using the specified properties.

Parameters​
properties?​

$Properties

Properties to set

Returns​

EnumSchema

EnumSchema instance


decode()​

static decode(reader, length?): EnumSchema & $Shape

Decodes an EnumSchema message from the specified reader or buffer.

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

length?​

number

Message length if known beforehand

Returns​

EnumSchema & $Shape

EnumSchema

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


decodeDelimited()​

static decodeDelimited(reader): EnumSchema & $Shape

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

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

Returns​

EnumSchema & $Shape

EnumSchema

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


encode()​

static encode(message, writer?): Writer

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

Parameters​

message​

$Properties

EnumSchema message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


encodeDelimited()​

static 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​

message​

$Properties

EnumSchema message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


fromObject()​

static fromObject(object): EnumSchema

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

Parameters​

object​

{[k: string]: any; }

Plain object

Returns​

EnumSchema

EnumSchema


toObject()​

static toObject(message, options?): object

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

Parameters​

message​

EnumSchema

EnumSchema

options?​

IConversionOptions

Conversion options

Returns​

object

Plain object