Class: Operation
protoc_gen_openapiv2.options.Operation
Operation is a representation of OpenAPI v2 specification's Operation object.
See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject
Example:
service EchoService { rpc Echo(SimpleMessage) returns (SimpleMessage) { option (google.api.http) = { get: "/v1/example/echo/{id}" };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Get a message."; operation_id: "getMessage"; tags: "echo"; responses: { key: "200" value: { description: "OK"; } } }; } }
Properties
consumes
• consumes: string[]
A list of MIME types the operation can consume. This overrides the consumes definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types.
deprecated
• deprecated: boolean
Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
description
• description: string
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
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 operation.
operationId
• operationId: string
Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.
parameters
• Optional parameters: null | $Properties
Custom parameters such as HTTP request headers. See: https://swagger.io/docs/specification/2-0/describing-parameters/ and https://swagger.io/specification/v2/#parameter-object.
produces
• produces: string[]
A list of MIME types the operation can produce. This overrides the produces definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types.
responses
• responses: Object
The list of possible responses as they are returned from executing this operation.
Index signature
▪ [k: string]: $Properties
schemes
• schemes: Scheme[]
The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the OpenAPI Object schemes definition.
security
• security: $Properties[]
A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
summary
• summary: string
A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
tags
• tags: string[]
A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
Methods
toJSON
▸ toJSON(): Object
Converts this Operation to JSON.
Returns
Object
JSON object
create
▸ create(properties?): Operation & $Shape
Creates a new Operation instance using the specified properties.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | $Shape | Properties to set |
Returns
Operation instance
▸ create(properties?): Operation
Parameters
| Name | Type |
|---|---|
properties? | $Properties |
Returns
decode
▸ decode(reader, length?): Operation & $Shape
Decodes an Operation 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
Operation
Throws
If the payload is not a reader or valid buffer
Throws
If required fields are missing
decodeDelimited
▸ decodeDelimited(reader): Operation & $Shape
Decodes an Operation message from the specified reader or buffer, length delimited.
Parameters
| Name | Type | Description |
|---|---|---|
reader | Uint8Array | Reader | Reader or buffer to decode from |
Returns
Operation
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 Operation message. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.Operation.verify|verify messages.
Parameters
| Name | Type | Description |
|---|---|---|
message | $Properties | Operation message or plain object to encode |
writer? | Writer | Writer to encode to |
Returns
Writer
Writer
encodeDelimited
▸ encodeDelimited(message, writer?): Writer
Encodes the specified Operation message, length delimited. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.Operation.verify|verify messages.
Parameters
| Name | Type | Description |
|---|---|---|
message | $Properties | Operation message or plain object to encode |
writer? | Writer | Writer to encode to |
Returns
Writer
Writer
fromObject
▸ fromObject(object): Operation
Creates an Operation message from a plain object. Also converts values to their respective internal types.
Parameters
| Name | Type | Description |
|---|---|---|
object | Object | Plain object |
Returns
Operation
toObject
▸ toObject(message, options?): Object
Creates a plain object from an Operation message. Also converts values to other types if specified.
Parameters
| Name | Type | Description |
|---|---|---|
message | Operation | Operation |
options? | IConversionOptions | Conversion options |
Returns
Object
Plain object