Crate salvo_oapi
source ·Expand description
OpenAPI support for salvo, modified from utoipa, It uses simple proc macros which you can use to annotate your code to have items documented.
§Crate Features
-
yamlEnables serde_yaml serialization of OpenAPI objects. -
chronoAdd support for chronoDateTime,Date,NaiveDateandDurationtypes. By default these types are parsed tostringtypes with additionalformatinformation.format: date-timeforDateTimeandformat: dateforDateandNaiveDateaccording RFC3339 asISO-8601. To override defaultstringrepresentation users have to usevalue_typeattribute to override the type. See docs for more details. -
timeAdd support for timeOffsetDateTime,PrimitiveDateTime,Date, andDurationtypes. By default these types are parsed asstring.OffsetDateTimeandPrimitiveDateTimewill usedate-timeformat.Datewill usedateformat andDurationwill not have any format. To override defaultstringrepresentation users have to usevalue_typeattribute to override the type. See docs for more details. -
decimalAdd support for rust_decimalDecimaltype. By default it is interpreted asString. If you wish to change the format you need to override the type. See thevalue_typeinToSchemaderive docs. -
decimal-floatAdd support for rust_decimalDecimaltype. By default it is interpreted asNumber. This feature is mutually exclusive with decimal and allow to change the default type used in your documentation forDecimalmuch likeserde_with_floatfeature exposed by rust_decimal. -
uuidAdd support for uuid.Uuidtype will be presented asStringwith formatuuidin OpenAPI spec. -
ulidAdd support for ulid.Ulidtype will be presented asStringwith formatulidin OpenAPI spec. -
urlAdd support for url.Urltype will be presented asStringwith formaturiin OpenAPI spec. -
smallvecAdd support for smallvec.SmallVecwill be treated asVec. -
indexmapAdd support for indexmap. When enabledIndexMapwill be rendered as a map similar toBTreeMapandHashMap.
§Go beyond the surface
- Browse to examples for more comprehensive examples.
- Check
ToResponsesandToResponsefor examples on deriving responses. - More about OpenAPI security in security documentation.
Re-exports§
pub use endpoint::Endpoint;pub use endpoint::EndpointArgRegister;pub use endpoint::EndpointOutRegister;pub use endpoint::EndpointRegistry;
Modules§
- Enhanced of handler for generate OpenAPI documention.
- Request extractors for the API operation.
- Implements OpenAPI Metadata types.
- Module for name schemas.
- Implements OpenAPI Operation Object types.
- Implements OpenAPI Parameter Object types.
- Implements OpenAPI Path Object types.
- rapidoc
rapidocThis crate implements necessary boiler plate code to serve RapiDoc via web server. It works as a bridge for serving the OpenAPI documentation created withsalvolibrary in the RapiDoc. - redoc
redocThis crate implements necessary boiler plate code to serve ReDoc via web server. It works as a bridge for serving the OpenAPI documentation created withsalvolibrary in the ReDoc. - Implements OpenAPI Request Body types.
- Implements OpenApi Responses.
- scalar
scalarThis crate implements necessary boiler plate code to serve Scalar via web server. It works as a bridge for serving the OpenAPI documentation created withsalvolibrary in the Scalar. - Implements OpenAPI Schema Object types which can be used to define field properties, enum values, array or object types.
- Implements OpenAPI Security Schema types.
- Implements OpenAPI Server Object types to configure target servers.
- swagger_
ui swagger-uiThis crate implements necessary boiler plate code to serve Swagger UI via web server. It works as a bridge for serving the OpenAPI documentation created withsalvolibrary in the Swagger UI.
Structs§
- Implements OpenAPI Components Object which holds supported reusable objects.
- OpenAPI Contact information of the API.
- Content holds request body content or response content.
- OpenAPI Discriminator object which can be optionally used together with
OneOfcomposite object. - Implements OpenAPI Example Object.
- Reference of external resource allowing extended documentation.
- Implements OpenAPI Header Object for response headers.
- Examples
- OpenAPI License information of the API.
- Implements subset of OpenAPI Schema Object which allows adding other
Schemas as properties to thisSchema. - Root object of the OpenAPI document.
- Implements OpenAPI Operation Object object.
- Collection for save
Operations. - Implements OpenAPI Parameter Object for
Operation. - Collection for OpenAPI Parameter Objects.
- Implements OpenAPI Path Item Object what describes
Operations available on a single path. - Implements OpenAPI Path Object types.
- Implements OpenAPI Reference Object that can be used to reference reusable components such as
Schemas orResponses. - Implements OpenAPI Request Body.
- Implements OpenAPI Response Object.
- Implements OpenAPI Responses Object.
- Schemas collection for OpenApi.
- OpenAPI security requirement object.
- Represents target server object. It can be used to alter server connection for path operations.
- Implements OpenAPI Server Variable used to substitute variables in
Server::url. - Server Variables information for OpenApi.
- Collection for
Serverobjects. - Implements OpenAPI Tag Object.
- Implements OpenAPI Xml Object.
Enums§
- Represents data type fragment of
Schema. - Value used to indicate whether reusable schema, parameter or operation is deprecated.
- Known schema format modifier property to provide fine detail of the primitive type.
- Represents available OpenAPI versions.
- In definition of
Parameter. - Defines how
Parametershould be serialized. - Path item operation type.
- A
Refor some other typeT. - Value used to indicate whether parameter or property is required.
- Is super type for OpenAPI Schema Object. Schema is reusable resource what can be referenced from path operations and other components using
Ref. - Additional format for
SchemaTypeto fine tune the data type used. - Represents type of
Schema. - OpenAPI security scheme for path operations.
Traits§
- Router extension trait for openapi metadata.
- Trait for converting a type to
Array. - Trait used to give
Parameterinformation for OpenAPI. - Trait used to convert implementing type to OpenAPI parameters.
- This trait is implemented to document a type (like an enum) which can represent request body, to be used in operation.
- This trait is implemented to document a type which represents a single response which can be referenced or reused as a component in multiple operations.
- This trait is implemented to document a type (like an enum) which can represent multiple responses, to be used in operation.
- Trait for implementing OpenAPI Schema object.
Type Aliases§
- The structure of the internal storage object paths.
- The structure of the internal storage object properties.
- Represents
nullabletype.
Attribute Macros§
- Enhanced of handler for generate OpenAPI documention.