Swagger
| Name | Tag | Type | Label | Description |
|---|---|---|---|---|
swagger | 1 | string | optional | Specifies the OpenAPI Specification version being used. It can be used by the OpenAPI UI and other clients to interpret the API listing. The value MUST be "2.0". |
info | 2 | Info | optional | Provides metadata about the API. The metadata can be used by the clients if needed. |
host | 3 | string | optional | The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support path templating. |
base_path | 4 | string | optional | The base path on which the API is served, which is relative to the host. If
it is not included, the API is served directly under the host. The value
MUST start with a leading slash (/). The basePath does not support path
templating.
Note that using |
schemes | 5 | Scheme | repeated | The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". If the schemes is not included, the default scheme to be used is the one used to access the OpenAPI definition itself. |
consumes | 6 | string | repeated | A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types. |
produces | 7 | string | repeated | A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types. |
responses | 10 | map<string, Response> | map | An object to hold responses that can be used across operations. This property does not define global responses for all operations. |
security_definitions | 11 | SecurityDefinitions | optional | Security scheme definitions that can be used across the specification. |
security | 12 | SecurityRequirement | repeated | A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. |
tags | 13 | Tag | repeated | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. |
external_docs | 14 | ExternalDocumentation | optional | Additional external documentation. |
extensions | 15 | map<string, google.protobuf.Value> | map | 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/ |
Swaggeris a representation of OpenAPI v2 specification's Swagger object.See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject
Example:
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Echo API"; version: "1.0"; description: ""; contact: { name: "gRPC-Gateway project"; url: "https://github.com/grpc-ecosystem/grpc-gateway"; email: "none@example.com"; }; license: { name: "BSD 3-Clause License"; url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE"; }; }; schemes: HTTPS; consumes: "application/json"; produces: "application/json"; };