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"; } } }; } }
Implements
Constructors
constructor
• new Operation(properties?): Operation
Constructs a new Operation.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | IOperation | Properties to set |
Returns
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.
Implementation of
deprecated
• deprecated: boolean
Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
Implementation of
description
• description: string
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
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 operation.
Implementation of
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.
Implementation of
parameters
• Optional parameters: null | IParameters
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.
Implementation of
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.
Implementation of
responses
• responses: Object
The list of possible responses as they are returned from executing this operation.
Index signature
▪ [k: string]: IResponse
Implementation of
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.
Implementation of
security
• security: ISecurityRequirement[]
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.
Implementation of
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.
Implementation of
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.
Implementation of
Methods
toJSON
▸ toJSON(): Object
Converts this Operation to JSON.
Returns
Object
JSON object
create
▸ create(properties?): Operation
Creates a new Operation instance using the specified properties.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | IOperation | Properties to set |
Returns
Operation instance
decode
▸ decode(reader, length?): Operation
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
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 | IOperation | 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 | IOperation | 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
getTypeUrl
▸ getTypeUrl(typeUrlPrefix?): string
Gets the default type url for Operation
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 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