You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature openapi_extensions with helper functions for JSON responses and requestBodies (#240)
* Add openapi_extensions with some helper functions for JSON requestBodies and JSON responses.
* Implement traits for RequestBody and Response and add tests for each implementation.
* Add docs
Even if there is no example for your favourite framework `utoipa` can be used with any
38
+
Even if there is no example for your favourite framework `utoipa` can be used with any
39
39
web framework which supports decorating functions with macros similarly to **warp** and **tide** examples.
40
40
41
41
## What's up with the word play?
@@ -49,34 +49,36 @@ and the `ipa` is _api_ reversed. Aaand... `ipa` is also awesome type of beer :be
49
49
***json** Enables **serde_json** serialization of OpenAPI objects which also allows usage of JSON within
50
50
OpenAPI values e.g. within `example` value. This is enabled by default.
51
51
***yaml** Enables **serde_yaml** serialization of OpenAPI objects.
52
-
***actix_extras** Enhances [actix-web](https://github.com/actix/actix-web/) integration with being able to
53
-
parse `path` and `path and query parameters` from actix web path attribute macros. See
52
+
***actix_extras** Enhances [actix-web](https://github.com/actix/actix-web/) integration with being able to
53
+
parse `path` and `path and query parameters` from actix web path attribute macros. See
54
54
[docs](https://docs.rs/utoipa/1.1.0/utoipa/attr.path.html#actix_extras-support-for-actix-web) or [examples](./examples) for more details.
55
55
***rocket_extras** Enhances [rocket](https://github.com/SergioBenitez/Rocket) framework integration with being
56
56
able to parse `path`, `path and query parameters` from rocket path attribute macros. See [docs](https://docs.rs/utoipa/1.1.0/utoipa/attr.path.html#rocket_extras-support-for-rocket)
57
57
or [examples](./examples) for more details.
58
-
***axum_extras** Enhances [axum](https://github.com/tokio-rs/axum) framework integration allowing users to use `IntoParams` without defining the `parameter_in` attribute. See
58
+
***axum_extras** Enhances [axum](https://github.com/tokio-rs/axum) framework integration allowing users to use `IntoParams` without defining the `parameter_in` attribute. See
59
59
[docs](https://docs.rs/utoipa/1.1.0/utoipa/attr.path.html#axum_extras-suppport-for-axum) or [examples](./examples) for more details.
60
60
***debug** Add extra traits such as debug traits to openapi definitions and elsewhere.
61
61
***chrono** Add support for [chrono](https://crates.io/crates/chrono)`DateTime`, `Date` and `Duration`
62
-
types. By default these types are parsed to `string` types without additional format. If you want to have
63
-
formats added to the types use *chrono_with_format* feature. This is useful because OpenAPI 3.1 spec
64
-
does not have date-time formats. To override default `string` representation
62
+
types. By default these types are parsed to `string` types without additional format. If you want to have
63
+
formats added to the types use *chrono_with_format* feature. This is useful because OpenAPI 3.1 spec
64
+
does not have date-time formats. To override default `string` representation
65
65
users have to use `value_type` attribute to override the type. See [docs](https://docs.rs/utoipa/1.1.0/utoipa/derive.Component.html) for more details.
66
-
***chrono_with_format** Add support to [chrono](https://crates.io/crates/chrono) types described above
66
+
***chrono_with_format** Add support to [chrono](https://crates.io/crates/chrono) types described above
67
67
with additional `format` information type. `date-time` for `DateTime` and `date` for `Date` according
68
-
[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) as `ISO-8601`. To override default `string` representation
68
+
[RFC3339](https://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) as `ISO-8601`. To override default `string` representation
69
69
users have to use `value_type` attribute to override the type. See [docs](https://docs.rs/utoipa/1.1.0/utoipa/derive.Component.html) for more details.
70
70
***time** Add support for [time](https://crates.io/crates/time)`OffsetDateTime`, `PrimitiveDateTime`, `Date`, and `Duration` types.
71
71
By default these types are parsed as `string`. `OffsetDateTime` and `PrimitiveDateTime` will use `date-time` format. `Date` will use
72
72
`date` format and `Duration` will not have any format. To override default `string` representation users have to use `value_type` attribute
73
73
to override the type. See [docs](https://docs.rs/utoipa/1.1.0/utoipa/derive.Component.html) for more details.
74
-
***decimal** Add support for [rust_decimal](https://crates.io/crates/rust_decimal)`Decimal` type. **By default**
75
-
it is interpreted as `String`. If you wish to change the format you need to override the type.
74
+
***decimal** Add support for [rust_decimal](https://crates.io/crates/rust_decimal)`Decimal` type. **By default**
75
+
it is interpreted as `String`. If you wish to change the format you need to override the type.
76
76
See the `value_type` in [component derive docs](https://docs.rs/utoipa/1.1.0/utoipa/derive.Component.html).
77
77
***uuid** Add support for [uuid](https://github.com/uuid-rs/uuid). `Uuid` type will be presented as `String` with
78
78
format `uuid` in OpenAPI spec.
79
79
***smallvec** Add support for [smallvec](https://crates.io/crates/smallvec). `SmallVec` will be treated as `Vec`.
80
+
***openapi_extensions** Adds traits and functions that provide extra convenience functions.
81
+
See the [`request_body` docs](https://docs.rs/utoipa/latest/utoipa/openapi/request_body) for an example.
80
82
81
83
Utoipa implicitly has partial support for `serde` attributes. See [docs](https://docs.rs/utoipa/1.1.0/utoipa/derive.Component.html#partial-serde-attributes-support) for more details.
82
84
@@ -121,7 +123,7 @@ Create a handler that would handle your business logic and add `path` proc attri
121
123
modpet_api {
122
124
/// Get pet by id
123
125
///
124
-
/// Get pet from database by pet id
126
+
/// Get pet from database by pet id
125
127
#[utoipa::path(
126
128
get,
127
129
path ="/pets/{id}",
@@ -249,5 +251,5 @@ This would produce api doc something similar to:
249
251
250
252
Licensed under either of [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) license at your option.
251
253
252
-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate
253
-
by you, shall be dual licensed, without any additional terms or conditions.
254
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate
255
+
by you, shall be dual licensed, without any additional terms or conditions.
0 commit comments