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

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: null | $Properties

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​

▸ create(properties?): EnumSchema & $Shape

Creates a new EnumSchema instance using the specified properties.

Parameters​

NameTypeDescription
properties?$ShapeProperties to set

Returns​

EnumSchema & $Shape

EnumSchema instance

▸ create(properties?): EnumSchema

Parameters​

NameType
properties?$Properties

Returns​

EnumSchema


decode​

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

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 & $Shape

EnumSchema

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited​

▸ decodeDelimited(reader): EnumSchema & $Shape

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

Parameters​

NameTypeDescription
readerUint8Array | ReaderReader 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​

▸ encode(message, writer?): Writer

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

Parameters​

NameTypeDescription
message$PropertiesEnumSchema 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
message$PropertiesEnumSchema 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


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