Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions utoipa-gen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@
* Add derive info support for derive OpenApi (https://github.com/juhaku/utoipa/pull/400)
* Add `merge` functionality for `OpenApi` (https://github.com/juhaku/utoipa/pull/397)
* Add derive servers attribute for OpenApi (https://github.com/juhaku/utoipa/pull/395)
* Add support for unit sructs (https://github.com/juhaku/utoipa/pull/392)
* Add support for unit structs (https://github.com/juhaku/utoipa/pull/392)
* Add support for `schema_with` custom fn reference (https://github.com/juhaku/utoipa/pull/390)
* Add support for multiple serde definitions (https://github.com/juhaku/utoipa/pull/389)
* Add support for tuple Path parameters for axum (https://github.com/juhaku/utoipa/pull/388)
Expand Down Expand Up @@ -534,7 +534,7 @@
* Update `ToSchema` documentation
* Chore make `serde_json` mandatory dependency (https://github.com/juhaku/utoipa/pull/378)
* Feature http status codes (https://github.com/juhaku/utoipa/pull/376)
* Refactor some path derive with `IntoParmas` tests
* Refactor some path derive with `IntoParams` tests
* Chore refine description attribute (https://github.com/juhaku/utoipa/pull/373)
* cargo format
* Update to axum 0.6.0 (https://github.com/juhaku/utoipa/pull/369)
2 changes: 1 addition & 1 deletion utoipa-gen/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl ExtSchema<'_> {
} else {
Cow::Borrowed(actual_body)
}
}).expect("ExtSchema must have actual request body resoved from TypeTree of handler fn argument")
}).expect("ExtSchema must have actual request body resolved from TypeTree of handler fn argument")
}

pub fn get_type_tree(&self) -> Result<Option<Cow<'_, TypeTree<'_>>>, Diagnostics> {
Expand Down
14 changes: 7 additions & 7 deletions utoipa-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
/// * `min_properties = ...` Can be used to define minimum number of properties this struct can
/// contain. Value must be a number.
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**. On
/// struct level the _`no_recursion`_ rule will be applied to all of its fields.
///
Expand Down Expand Up @@ -202,7 +202,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
///* `ignore` or `ignore = ...` Can be used to skip the field from being serialized to OpenAPI schema. It accepts either a literal `bool` value
/// or a path to a function that returns `bool` (`Fn() -> bool`).
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**.
///
/// #### Field nullability and required rules
Expand Down Expand Up @@ -267,7 +267,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
/// * `content_media_type = ...` Can be used to define MIME type of a string for underlying schema object.
/// See [`Object::content_media_type`][schema_object_media_type]
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**.
///
/// # Enum Optional Configuration Options for `#[schema(...)]`
Expand Down Expand Up @@ -335,7 +335,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
/// field for enums with single unnamed _`ToSchema`_ reference field. See the [discriminator
/// syntax][derive@ToSchema#schemadiscriminator-syntax].
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**. On
/// enum level the _`no_recursion`_ rule will be applied to all of its variants.
///
Expand Down Expand Up @@ -391,7 +391,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
/// * `min_properties = ...` Can be used to define minimum number of properties this struct can
/// contain. Value must be a number.
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**. On
/// named field variant level the _`no_recursion`_ rule will be applied to all of its fields.
///
Expand Down Expand Up @@ -422,7 +422,7 @@ static CONFIG: once_cell::sync::Lazy<utoipa_config::Config> =
/// not in the code. If you'd like to mark the field as deprecated in the code as well use
/// Rust's own `#[deprecated]` attribute instead.
///* `no_recursion` Is used to break from recursion in case of looping schema tree e.g. `Pet` ->
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Ower` type not to allow
/// `Owner` -> `Pet`. _`no_recursion`_ attribute must be used within `Owner` type not to allow
/// recurring into `Pet`. Failing to do so will cause infinite loop and runtime **panic**.
///
/// #### Mixed Enum Unnamed Field Variant's Field Configuration Options
Expand Down Expand Up @@ -3771,7 +3771,7 @@ mod parse_utils {
Punctuated::parse_terminated(&group)
}

pub fn parse_comma_separated_within_parethesis_with<T>(
pub fn parse_comma_separated_within_parenthesis_with<T>(
input: ParseStream,
with: fn(ParseStream) -> syn::Result<T>,
) -> syn::Result<Punctuated<T, Comma>>
Expand Down
12 changes: 6 additions & 6 deletions utoipa-gen/src/openapi/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,19 +412,19 @@ mod tests {
#[test]
fn contact_from_only_name() {
let author = "Suzy Lin";
let contanct = Contact::try_from(author.to_string()).unwrap();
let contact = Contact::try_from(author.to_string()).unwrap();

assert!(contanct.name.is_some(), "Suzy should have name");
assert!(contanct.email.is_none(), "Suzy should not have email");
assert!(contact.name.is_some(), "Suzy should have name");
assert!(contact.email.is_none(), "Suzy should not have email");
}

#[test]
fn contact_from_name_and_email() {
let author = "Suzy Lin <suzy@lin.com>";
let contanct = Contact::try_from(author.to_string()).unwrap();
let contact = Contact::try_from(author.to_string()).unwrap();

assert!(contanct.name.is_some(), "Suzy should have name");
assert!(contanct.email.is_some(), "Suzy should have email");
assert!(contact.name.is_some(), "Suzy should have name");
assert!(contact.email.is_some(), "Suzy should have email");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl HttpMethod {
.map_err(|error| {
let mut diagnostics = Diagnostics::with_span(ident.span(), error.to_string());
if name == "connect" {
diagnostics = diagnostics.note("HTTP method `CONNET` is not supported by OpenAPI spec <https://spec.openapis.org/oas/latest.html#path-item-object>");
diagnostics = diagnostics.note("HTTP method `CONNECT` is not supported by OpenAPI spec <https://spec.openapis.org/oas/latest.html#path-item-object>");
}

diagnostics
Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/src/path/request_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl Parse for RequestBodyAttr<'_> {
}

let media_type =
parse_utils::parse_comma_separated_within_parethesis_with(
parse_utils::parse_comma_separated_within_parenthesis_with(
&group,
group_parser,
)?
Expand Down
10 changes: 6 additions & 4 deletions utoipa-gen/src/path/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,12 @@ impl<'r> ResponseValue<'r> {
buf.call(MediaTypeAttr::parse)
}

let content =
parse_utils::parse_comma_separated_within_parethesis_with(input, group_parser)?
.into_iter()
.collect::<Vec<_>>();
let content = parse_utils::parse_comma_separated_within_parenthesis_with(
input,
group_parser,
)?
.into_iter()
.collect::<Vec<_>>();

self.content = content;
}
Expand Down
6 changes: 3 additions & 3 deletions utoipa-gen/tests/path_derive_axum_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ fn derive_path_params_with_unnamed_struct_destructed() {
fn derive_path_query_params_with_named_struct_destructed() {
#[derive(IntoParams)]
#[allow(unused)]
struct QueryParmas<'q> {
struct QueryParams<'q> {
name: &'q str,
}

#[utoipa::path(get, path = "/item", params(QueryParmas))]
#[utoipa::path(get, path = "/item", params(QueryParams))]
#[allow(unused)]
async fn get_item(Query(QueryParmas { name }): Query<QueryParmas<'static>>) {}
async fn get_item(Query(QueryParams { name }): Query<QueryParams<'static>>) {}

#[derive(OpenApi)]
#[openapi(paths(get_item))]
Expand Down
4 changes: 2 additions & 2 deletions utoipa/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Migration guide: https://github.com/juhaku/utoipa/discussions/456
* Add derive info support for derive OpenApi (https://github.com/juhaku/utoipa/pull/400)
* Add `merge` functionality for `OpenApi` (https://github.com/juhaku/utoipa/pull/397)
* Add derive servers attribute for OpenApi (https://github.com/juhaku/utoipa/pull/395)
* Add support for unit sructs (https://github.com/juhaku/utoipa/pull/392)
* Add support for unit structs (https://github.com/juhaku/utoipa/pull/392)
* Add support for `schema_with` custom fn reference (https://github.com/juhaku/utoipa/pull/390)
* Add support for multiple serde definitions (https://github.com/juhaku/utoipa/pull/389)
* Add support for tuple Path parameters for axum (https://github.com/juhaku/utoipa/pull/388)
Expand Down Expand Up @@ -542,7 +542,7 @@ Migration guide: https://github.com/juhaku/utoipa/discussions/456
* Use BTreeMap for responses of components to make it fixed order (https://github.com/juhaku/utoipa/pull/380)
* Chore make `serde_json` mandatory dependency (https://github.com/juhaku/utoipa/pull/378)
* Feature http status codes (https://github.com/juhaku/utoipa/pull/376)
* Refactor some path derive with `IntoParmas` tests
* Refactor some path derive with `IntoParams` tests
* Update utoipa-swagger-ui install example
* Chore refine description attribute (https://github.com/juhaku/utoipa/pull/373)
* Update swagger-ui dependencies versions
Expand Down