pub struct Swagger {Show 13 fields
pub swagger: String,
pub info: Option<Info>,
pub host: String,
pub base_path: String,
pub schemes: Vec<i32>,
pub consumes: Vec<String>,
pub produces: Vec<String>,
pub responses: HashMap<String, Response>,
pub security_definitions: Option<SecurityDefinitions>,
pub security: Vec<SecurityRequirement>,
pub tags: Vec<Tag>,
pub external_docs: Option<ExternalDocumentation>,
pub extensions: HashMap<String, Value>,
}Expand description
Swagger is 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”; };
Fields§
§swagger: StringSpecifies 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: Option<Info>Provides metadata about the API. The metadata can be used by the clients if needed.
host: StringThe 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: StringThe 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 base_path does not change the endpoint paths that are
generated in the resulting OpenAPI file. If you wish to use base_path
with relatively generated OpenAPI paths, the base_path prefix must be
manually removed from your google.api.http paths and your code changed to
serve the API from the base_path.
schemes: Vec<i32>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: Vec<String>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: Vec<String>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: HashMap<String, Response>An object to hold responses that can be used across operations. This property does not define global responses for all operations.
security_definitions: Option<SecurityDefinitions>Security scheme definitions that can be used across the specification.
security: Vec<SecurityRequirement>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.
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: Option<ExternalDocumentation>Additional external documentation.
extensions: HashMap<String, Value>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/
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Swagger
impl<'de> Deserialize<'de> for Swagger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Message for Swagger
impl Message for Swagger
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.impl StructuralPartialEq for Swagger
Auto Trait Implementations§
impl Freeze for Swagger
impl RefUnwindSafe for Swagger
impl Send for Swagger
impl Sync for Swagger
impl Unpin for Swagger
impl UnwindSafe for Swagger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request