Crate swagger

Source
Expand description

Support crate for Swagger codegen.

§Crate features

Crate features exist to reduce the dependencies on the crate. Most features should be enabled by the generator when relevant.

By default, the serdejson feature is enabled.

§Format support

  • multipart_form - Enable support for multipart/form-data as described in RFC 7578
  • multipart_related - Enable support for multipart/related as described in RFC 2387
  • serdejson - Enable JSON serialization/deserialization support using serde.

§Feature support

  • serdevalid - Enable support for JSON schema based validation
  • conversion - Enable support for Frunk-based conversion - in particular, transmogrification

§Use case support

  • client - Enable support for providing an OpenAPI client
  • server - Enable support for providing an OpenAPI server
  • http1 - Enable support for HTTP/1 based APIs - RFC 9112
  • http2 - Enable support for HTTP/2 based APIs - RFC 9113
  • tcp - Enable support for HTTP over TCP
  • tls - Enable support for HTTP over TLS (HTTPS)
  • uds - Enable support for HTTP over UDS (Unix Domain Sockets)

Re-exports§

pub use base64_format::ByteArray;
pub use nullable_format::Nullable;
pub use auth::AuthData;
pub use auth::Authorization;
pub use context::ContextBuilder;
pub use context::ContextWrapper;
pub use context::EmptyContext;
pub use context::Has;
pub use context::Pop;
pub use context::Push;
pub use connector::Connector;client
pub use composites::CompositeMakeService;server and (http1 or http2)
pub use composites::CompositeMakeServiceEntry;server and (http1 or http2)
pub use composites::CompositeService;server and (http1 or http2)
pub use composites::NotFound;server and (http1 or http2)
pub use add_context::AddContextMakeService;
pub use add_context::AddContextService;
pub use drop_context::DropContextMakeService;
pub use drop_context::DropContextService;
pub use request_parser::RequestParser;

Modules§

add_context
Hyper service that adds a context to an incoming request and passes it on to a wrapped service.
auth
Authentication and authorization data structures
base64_format
Module for encoding API properties in base64.
compositesserver and (http1 or http2)
Module for combining hyper services
connectorclient
Module with utilities for creating connectors with hyper. Utility methods for instantiating common connectors for clients.
context
Module for API context management.
drop_context
Hyper service that drops a context to an incoming request and passes it on to a wrapped service.
multipart
Helper functions for multipart encodings
nullable_format
Module for encoding Nullable properties.
request_parser
Methods for retrieving swagger-related information from an HTTP request.

Macros§

make_context
Macro for easily defining context values. The first argument should be a context type created with new_context_type! and subsequent arguments are the values to be stored in the context, with the outermost first.
make_context_ty
Macro for easily defining context types. The first argument should be a context type created with new_context_type! and subsequent arguments are the types to be stored in the context, with the outermost first.
new_context_type
Defines a struct that can be used to build up contexts recursively by adding one item to the context at a time, and a unit struct representing an empty context. The first argument is the name of the newly defined context struct that is used to add an item to the context, the second argument is the name of the empty context struct, and subsequent arguments are the types that can be stored in contexts built using these struct.
request_parser_joiner
A macro for joining together two or more RequestParsers to create a struct that implements RequestParser with a function parse_operation_id that matches hyper requests against the different RequestParsers in turn until it gets a match (or returns an error if none match)

Structs§

ApiError
Very simple error type - just holds a description of the error. This is useful for human diagnosis and troubleshooting, but not for applications to parse. The justification for this is to deny applications visibility into the communication layer, forcing the application code to act solely on the logical responses that the API provides, promoting abstraction in the application code.
XSpanIdString
Wrapper for a string being used as an X-Span-ID.

Enums§

AnyOf1
AnyOf1 type.
AnyOf2
AnyOf2 type.
AnyOf3
AnyOf3 type.
AnyOf4
AnyOf4 type.
AnyOf5
AnyOf5 type.
AnyOf6
AnyOf6 type.
AnyOf7
AnyOf7 type.
AnyOf8
AnyOf8 type.
AnyOf9
AnyOf9 type.
AnyOf10
AnyOf10 type.
AnyOf11
AnyOf11 type.
AnyOf12
AnyOf12 type.
AnyOf13
AnyOf13 type.
AnyOf14
AnyOf14 type.
AnyOf15
AnyOf15 type.
AnyOf16
AnyOf16 type.
OneOf1
OneOf1 type.
OneOf2
OneOf2 type.
OneOf3
OneOf3 type.
OneOf4
OneOf4 type.
OneOf5
OneOf5 type.
OneOf6
OneOf6 type.
OneOf7
OneOf7 type.
OneOf8
OneOf8 type.
OneOf9
OneOf9 type.
OneOf10
OneOf10 type.
OneOf11
OneOf11 type.
OneOf12
OneOf12 type.
OneOf13
OneOf13 type.
OneOf14
OneOf14 type.
OneOf15
OneOf15 type.
OneOf16
OneOf16 type.

Constants§

X_SPAN_ID
Header - X-Span-ID - used to track a request through a chain of microservices.

Traits§

BodyExt
Additional function for hyper::Body
ErrorBound
Helper Bound for Errors for MakeService/Service wrappers