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
| Name | Type | Description |
|---|---|---|
properties? | IEnumSchema | Properties to set |
Returns
Properties
default
• default: string
EnumSchema default.
Implementation of
description
• description: string
A short description of the schema.
Implementation of
example
• example: string
EnumSchema example.
Implementation of
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
externalDocs
• Optional externalDocs: null | IExternalDocumentation
Additional external documentation for this schema.
Implementation of
readOnly
• readOnly: boolean
EnumSchema readOnly.
Implementation of
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
required
• required: boolean
EnumSchema required.
Implementation of
title
• title: string
The title of the schema.
Implementation of
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
| Name | Type | Description |
|---|---|---|
properties? | IEnumSchema | Properties to set |
Returns
EnumSchema instance
decode
▸ decode(reader, length?): EnumSchema
Decodes an EnumSchema message from the specified reader or buffer.
Parameters
| Name | Type | Description |
|---|---|---|
reader | Uint8Array | Reader | Reader or buffer to decode from |
length? | number | Message length if known beforehand |
Returns
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
| Name | Type | Description |
|---|---|---|
reader | Uint8Array | Reader | Reader or buffer to decode from |
Returns
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
| Name | Type | Description |
|---|---|---|
message | IEnumSchema | EnumSchema message or plain object to encode |
writer? | Writer | Writer 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
| Name | Type | Description |
|---|---|---|
message | IEnumSchema | EnumSchema message or plain object to encode |
writer? | Writer | Writer 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
| Name | Type | Description |
|---|---|---|
object | Object | Plain object |
Returns
EnumSchema
getTypeUrl
▸ getTypeUrl(typeUrlPrefix?): string
Gets the default type url for EnumSchema
Parameters
| Name | Type | Description |
|---|---|---|
typeUrlPrefix? | string | your 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
| Name | Type | Description |
|---|---|---|
message | EnumSchema | EnumSchema |
options? | IConversionOptions | Conversion options |
Returns
Object
Plain object