diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/README.md b/samples/server/petstore/rust-axum/output/multipart-v3/README.md index 72b7f696506..c0bbd503dd1 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/README.md +++ b/samples/server/petstore/rust-axum/output/multipart-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/src/types.rs b/samples/server/petstore/rust-axum/output/multipart-v3/src/types.rs index 17faecc35e6..0e80a9b0a42 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/src/types.rs +++ b/samples/server/petstore/rust-axum/output/multipart-v3/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use multipart_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use multipart_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/README.md b/samples/server/petstore/rust-axum/output/openapi-v3/README.md index 17d0e3c07b2..4b9ef356ee1 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-axum/output/openapi-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs index d7d7e8232db..c8908cfc14d 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs @@ -43,6 +43,22 @@ pub enum EnumInPathPathParamGetResponse { Status200_Success, } +#[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum FormTestResponse { + /// OK + Status200_OK, +} + +#[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum GetWithBooleanParameterResponse { + /// OK + Status200_OK, +} + #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] @@ -95,6 +111,14 @@ pub enum MultipleAuthSchemeGetResponse { Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks, } +#[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse { + /// Success + Status200_Success, +} + #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] @@ -173,6 +197,14 @@ pub enum Rfc7807GetResponse { Status406_NotAcceptable(String), } +#[derive(Debug, PartialEq, Serialize, Deserialize)] +#[must_use] +#[allow(clippy::large_enum_variant)] +pub enum TwoFirstLetterHeadersResponse { + /// OK + Status200_OK, +} + #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] @@ -279,6 +311,26 @@ pub trait Default { path_params: models::EnumInPathPathParamGetPathParams, ) -> Result; + /// Test a Form Post. + /// + /// FormTest - POST /form-test + async fn form_test( + &self, + method: Method, + host: Host, + cookies: CookieJar, + body: models::FormTestRequest, + ) -> Result; + + /// GetWithBooleanParameter - GET /get-with-bool + async fn get_with_boolean_parameter( + &self, + method: Method, + host: Host, + cookies: CookieJar, + query_params: models::GetWithBooleanParameterQueryParams, + ) -> Result; + /// JsonComplexQueryParamGet - GET /json-complex-query-param async fn json_complex_query_param_get( &self, @@ -323,6 +375,18 @@ pub trait Default { cookies: CookieJar, ) -> Result; + /// MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGet - GET /multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b} + async fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get( + &self, + method: Method, + host: Host, + cookies: CookieJar, + path_params: models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams, + ) -> Result< + MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse, + String, + >; + /// OneOfGet - GET /one-of async fn one_of_get( &self, @@ -392,6 +456,15 @@ pub trait Default { cookies: CookieJar, ) -> Result; + /// TwoFirstLetterHeaders - POST /operation-two-first-letter-headers + async fn two_first_letter_headers( + &self, + method: Method, + host: Host, + cookies: CookieJar, + header_params: models::TwoFirstLetterHeadersHeaderParams, + ) -> Result; + /// UntypedPropertyGet - GET /untyped_property async fn untyped_property_get( &self, @@ -436,7 +509,7 @@ pub trait Default { body: Bytes, ) -> Result; - /// Post an array. + /// Post an array. It's important we test apostrophes, so include one here.. /// /// XmlPost - POST /xml async fn xml_post( diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs index 6e5322a67b5..87d1c7fd8ca 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs @@ -38,6 +38,14 @@ pub struct EnumInPathPathParamGetPathParams { pub path_param: models::StringEnum, } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct GetWithBooleanParameterQueryParams { + /// Let's check apostrophes get encoded properly! + #[serde(rename = "iambool")] + pub iambool: bool, +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct JsonComplexQueryParamGetQueryParams { @@ -52,6 +60,13 @@ pub struct MandatoryRequestHeaderGetHeaderParams { pub x_header: String, } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams { + pub path_param_a: String, + pub path_param_b: String, +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ParamgetGetQueryParams { @@ -76,12 +91,82 @@ pub struct RegisterCallbackPostQueryParams { pub url: String, } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct TwoFirstLetterHeadersHeaderParams { + pub x_header_one: Option, + pub x_header_two: Option, +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct GetRepoInfoPathParams { pub repo_id: String, } +/// Check that an object with only additional properties that references another object (e.g. an anyOf object) isn't treated as freeForm +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct AdditionalPropertiesReferencedAnyOfObject( + std::collections::HashMap, +); + +impl validator::Validate for AdditionalPropertiesReferencedAnyOfObject { + fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> { + std::result::Result::Ok(()) + } +} + +impl std::convert::From> + for AdditionalPropertiesReferencedAnyOfObject +{ + fn from(x: std::collections::HashMap) -> Self { + AdditionalPropertiesReferencedAnyOfObject(x) + } +} + +impl std::convert::From + for std::collections::HashMap +{ + fn from(x: AdditionalPropertiesReferencedAnyOfObject) -> Self { + x.0 + } +} + +impl std::ops::Deref for AdditionalPropertiesReferencedAnyOfObject { + type Target = std::collections::HashMap; + fn deref(&self) -> &std::collections::HashMap { + &self.0 + } +} + +impl std::ops::DerefMut for AdditionalPropertiesReferencedAnyOfObject { + fn deref_mut(&mut self) -> &mut std::collections::HashMap { + &mut self.0 + } +} + +/// Converts the AdditionalPropertiesReferencedAnyOfObject value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for AdditionalPropertiesReferencedAnyOfObject { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + // Skipping additionalProperties in query parameter serialization + write!(f, "") + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AdditionalPropertiesReferencedAnyOfObject value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl ::std::str::FromStr for AdditionalPropertiesReferencedAnyOfObject { + type Err = &'static str; + + fn from_str(s: &str) -> std::result::Result { + std::result::Result::Err("Parsing additionalProperties for AdditionalPropertiesReferencedAnyOfObject is not supported") + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AdditionalPropertiesWithList(std::collections::HashMap>); @@ -144,6 +229,154 @@ impl ::std::str::FromStr for AdditionalPropertiesWithList { } } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct AdditionalPropertiesWithNullable { + #[serde(rename = "nullableString")] + #[serde(deserialize_with = "deserialize_optional_nullable")] + #[serde(default = "default_optional_nullable")] + #[serde(skip_serializing_if = "Option::is_none")] + pub nullable_string: Option>, + + #[serde(rename = "nullableMap")] + #[serde(skip_serializing_if = "Option::is_none")] + pub nullable_map: Option>, +} + +impl AdditionalPropertiesWithNullable { + #[allow(clippy::new_without_default, clippy::too_many_arguments)] + pub fn new() -> AdditionalPropertiesWithNullable { + AdditionalPropertiesWithNullable { + nullable_string: None, + nullable_map: None, + } + } +} + +/// Converts the AdditionalPropertiesWithNullable value to the Query Parameters representation (style=form, explode=false) +/// specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde serializer +impl std::fmt::Display for AdditionalPropertiesWithNullable { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let params: Vec> = vec![ + self.nullable_string.as_ref().map(|nullable_string| { + [ + "nullableString".to_string(), + nullable_string + .as_ref() + .map_or("null".to_string(), |x| x.to_string()), + ] + .join(",") + }), + // Skipping nullableMap in query parameter serialization + ]; + + write!( + f, + "{}", + params.into_iter().flatten().collect::>().join(",") + ) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AdditionalPropertiesWithNullable value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for AdditionalPropertiesWithNullable { + type Err = String; + + fn from_str(s: &str) -> std::result::Result { + /// An intermediate representation of the struct to use for parsing. + #[derive(Default)] + #[allow(dead_code)] + struct IntermediateRep { + pub nullable_string: Vec, + pub nullable_map: Vec>, + } + + let mut intermediate_rep = IntermediateRep::default(); + + // Parse into intermediate representation + let mut string_iter = s.split(','); + let mut key_result = string_iter.next(); + + while key_result.is_some() { + let val = match string_iter.next() { + Some(x) => x, + None => { + return std::result::Result::Err( + "Missing value while parsing AdditionalPropertiesWithNullable".to_string(), + ) + } + }; + + if let Some(key) = key_result { + #[allow(clippy::match_single_binding)] + match key { + "nullableString" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in AdditionalPropertiesWithNullable".to_string()), + "nullableMap" => return std::result::Result::Err("Parsing a container in this style is not supported in AdditionalPropertiesWithNullable".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing AdditionalPropertiesWithNullable".to_string()) + } + } + + // Get the next key + key_result = string_iter.next(); + } + + // Use the intermediate representation to return the struct + std::result::Result::Ok(AdditionalPropertiesWithNullable { + nullable_string: std::result::Result::Err( + "Nullable types not supported in AdditionalPropertiesWithNullable".to_string(), + )?, + nullable_map: intermediate_rep.nullable_map.into_iter().next(), + }) + } +} + +// Methods for converting between header::IntoHeaderValue and HeaderValue + +#[cfg(feature = "server")] +impl std::convert::TryFrom> + for HeaderValue +{ + type Error = String; + + fn try_from( + hdr_value: header::IntoHeaderValue, + ) -> std::result::Result { + let hdr_value = hdr_value.to_string(); + match HeaderValue::from_str(&hdr_value) { + std::result::Result::Ok(value) => std::result::Result::Ok(value), + std::result::Result::Err(e) => std::result::Result::Err( + format!("Invalid header value for AdditionalPropertiesWithNullable - value: {} is invalid {}", + hdr_value, e)) + } + } +} + +#[cfg(feature = "server")] +impl std::convert::TryFrom + for header::IntoHeaderValue +{ + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> std::result::Result { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match ::from_str(value) { + std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)), + std::result::Result::Err(err) => std::result::Result::Err( + format!("Unable to convert header value '{}' into AdditionalPropertiesWithNullable - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct AnotherXmlArray(Vec); @@ -501,6 +734,37 @@ impl PartialEq for AnyOfGet202Response { } } +/// Test a model containing an anyOf of a hash map + +/// Any of: +/// - String +/// - std::collections::HashMap +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct AnyOfHashMapObject(Box); + +impl validator::Validate for AnyOfHashMapObject { + fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> { + std::result::Result::Ok(()) + } +} + +/// Converts Query Parameters representation (style=form, explode=false) to a AnyOfHashMapObject value +/// as specified in https://swagger.io/docs/specification/serialization/ +/// Should be implemented in a serde deserializer +impl std::str::FromStr for AnyOfHashMapObject { + type Err = serde_json::Error; + + fn from_str(s: &str) -> std::result::Result { + serde_json::from_str(s) + } +} + +impl PartialEq for AnyOfHashMapObject { + fn eq(&self, other: &Self) -> bool { + self.0.get() == other.0.get() + } +} + /// Test a model containing an anyOf /// Any of: @@ -1323,6 +1587,54 @@ impl std::convert::TryFrom for header::IntoHeaderValue { } } +#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)] +#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] +pub struct NullableObject(String); + +impl validator::Validate for NullableObject { + fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> { + std::result::Result::Ok(()) + } +} + +impl std::convert::From for NullableObject { + fn from(x: String) -> Self { + NullableObject(x) + } +} + +impl std::fmt::Display for NullableObject { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } +} + +impl std::str::FromStr for NullableObject { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(NullableObject(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: NullableObject) -> Self { + x.0 + } +} + +impl std::ops::Deref for NullableObject { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for NullableObject { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct NullableTest { diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs index 8f4de4324d7..ee704dda76f 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs @@ -20,59 +20,89 @@ where { // build our application with a route Router::new() - .route("/any-of", get(any_of_get::)) - .route( - "/callback-with-header", - post(callback_with_header_post::), + .route("/any-of", + get(any_of_get::) ) - .route("/complex-query-param", get(complex_query_param_get::)) - .route( - "/enum_in_path/:path_param", - get(enum_in_path_path_param_get::), + .route("/callback-with-header", + post(callback_with_header_post::) ) - .route( - "/json-complex-query-param", - get(json_complex_query_param_get::), + .route("/complex-query-param", + get(complex_query_param_get::) ) - .route( - "/mandatory-request-header", - get(mandatory_request_header_get::), + .route("/enum_in_path/:path_param", + get(enum_in_path_path_param_get::) ) - .route("/merge-patch-json", get(merge_patch_json_get::)) - .route("/multiget", get(multiget_get::)) - .route( - "/multiple_auth_scheme", - get(multiple_auth_scheme_get::), + .route("/form-test", + post(form_test::) ) - .route("/one-of", get(one_of_get::)) - .route("/override-server", get(override_server_get::)) - .route("/paramget", get(paramget_get::)) - .route( - "/readonly_auth_scheme", - get(readonly_auth_scheme_get::), + .route("/get-with-bool", + get(get_with_boolean_parameter::) ) - .route("/register-callback", post(register_callback_post::)) - .route("/repos", post(create_repo::)) - .route( - "/repos/:repo_id", - get(get_repo_info::).get(get_repo_info::), + .route("/json-complex-query-param", + get(json_complex_query_param_get::) ) - .route( - "/required_octet_stream", - put(required_octet_stream_put::), + .route("/mandatory-request-header", + get(mandatory_request_header_get::) ) - .route( - "/responses_with_headers", - get(responses_with_headers_get::), + .route("/merge-patch-json", + get(merge_patch_json_get::) ) - .route("/rfc7807", get(rfc7807_get::)) - .route("/untyped_property", get(untyped_property_get::)) - .route("/uuid", get(uuid_get::)) - .route("/xml", post(xml_post::).put(xml_put::)) - .route("/xml_extra", post(xml_extra_post::)) - .route( - "/xml_other", - post(xml_other_post::).put(xml_other_put::), + .route("/multiget", + get(multiget_get::) + ) + .route("/multiple-path-params-with-very-long-path-to-test-formatting/:path_param_a/:path_param_b", + get(multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get::) + ) + .route("/multiple_auth_scheme", + get(multiple_auth_scheme_get::) + ) + .route("/one-of", + get(one_of_get::) + ) + .route("/operation-two-first-letter-headers", + post(two_first_letter_headers::) + ) + .route("/override-server", + get(override_server_get::) + ) + .route("/paramget", + get(paramget_get::) + ) + .route("/readonly_auth_scheme", + get(readonly_auth_scheme_get::) + ) + .route("/register-callback", + post(register_callback_post::) + ) + .route("/repos", + post(create_repo::) + ) + .route("/repos/:repo_id", + get(get_repo_info::).get(get_repo_info::) + ) + .route("/required_octet_stream", + put(required_octet_stream_put::) + ) + .route("/responses_with_headers", + get(responses_with_headers_get::) + ) + .route("/rfc7807", + get(rfc7807_get::) + ) + .route("/untyped_property", + get(untyped_property_get::) + ) + .route("/uuid", + get(uuid_get::) + ) + .route("/xml", + post(xml_post::).put(xml_put::) + ) + .route("/xml_extra", + post(xml_extra_post::) + ) + .route("/xml_other", + post(xml_other_post::).put(xml_other_put::) ) .with_state(api_impl) } @@ -370,6 +400,128 @@ where }) } +#[derive(validator::Validate)] +#[allow(dead_code)] +struct FormTestBodyValidator<'a> { + #[validate(nested)] + body: &'a models::FormTestRequest, +} + +#[tracing::instrument(skip_all)] +fn form_test_validation( + body: models::FormTestRequest, +) -> std::result::Result<(models::FormTestRequest,), ValidationErrors> { + let b = FormTestBodyValidator { body: &body }; + b.validate()?; + + Ok((body,)) +} +/// FormTest - POST /form-test +#[tracing::instrument(skip_all)] +async fn form_test( + method: Method, + host: Host, + cookies: CookieJar, + State(api_impl): State, + Form(body): Form, +) -> Result +where + I: AsRef + Send + Sync, + A: apis::default::Default, +{ + let validation = form_test_validation(body); + + let Ok((body,)) = validation else { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(validation.unwrap_err().to_string())) + .map_err(|_| StatusCode::BAD_REQUEST); + }; + + let result = api_impl + .as_ref() + .form_test(method, host, cookies, body) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + apis::default::FormTestResponse::Status200_OK => { + let mut response = response.status(200); + response.body(Body::empty()) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + } + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} + +#[tracing::instrument(skip_all)] +fn get_with_boolean_parameter_validation( + query_params: models::GetWithBooleanParameterQueryParams, +) -> std::result::Result<(models::GetWithBooleanParameterQueryParams,), ValidationErrors> { + query_params.validate()?; + + Ok((query_params,)) +} +/// GetWithBooleanParameter - GET /get-with-bool +#[tracing::instrument(skip_all)] +async fn get_with_boolean_parameter( + method: Method, + host: Host, + cookies: CookieJar, + Query(query_params): Query, + State(api_impl): State, +) -> Result +where + I: AsRef + Send + Sync, + A: apis::default::Default, +{ + let validation = get_with_boolean_parameter_validation(query_params); + + let Ok((query_params,)) = validation else { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(validation.unwrap_err().to_string())) + .map_err(|_| StatusCode::BAD_REQUEST); + }; + + let result = api_impl + .as_ref() + .get_with_boolean_parameter(method, host, cookies, query_params) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + apis::default::GetWithBooleanParameterResponse::Status200_OK => { + let mut response = response.status(200); + response.body(Body::empty()) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + } + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} + #[tracing::instrument(skip_all)] fn json_complex_query_param_get_validation( query_params: models::JsonComplexQueryParamGetQueryParams, @@ -826,6 +978,81 @@ where }) } +#[tracing::instrument(skip_all)] +fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get_validation( + path_params: models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams, +) -> std::result::Result< + (models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams,), + ValidationErrors, +> { + path_params.validate()?; + + Ok((path_params,)) +} +/// MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGet - GET /multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b} +#[tracing::instrument(skip_all)] +async fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get< + I, + A, +>( + method: Method, + host: Host, + cookies: CookieJar, + Path(path_params): Path< + models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams, + >, + State(api_impl): State, +) -> Result +where + I: AsRef + Send + Sync, + A: apis::default::Default, +{ + let validation = + multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get_validation( + path_params, + ) + ; + + let Ok((path_params,)) = validation else { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(validation.unwrap_err().to_string())) + .map_err(|_| StatusCode::BAD_REQUEST); + }; + + let result = api_impl + .as_ref() + .multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get( + method, + host, + cookies, + path_params, + ) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + apis::default::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse::Status200_Success + => { + let mut response = response.status(200); + response.body(Body::empty()) + }, + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + }, + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} + #[tracing::instrument(skip_all)] fn one_of_get_validation() -> std::result::Result<(), ValidationErrors> { Ok(()) @@ -1456,6 +1683,106 @@ where }) } +#[tracing::instrument(skip_all)] +fn two_first_letter_headers_validation( + header_params: models::TwoFirstLetterHeadersHeaderParams, +) -> std::result::Result<(models::TwoFirstLetterHeadersHeaderParams,), ValidationErrors> { + header_params.validate()?; + + Ok((header_params,)) +} +/// TwoFirstLetterHeaders - POST /operation-two-first-letter-headers +#[tracing::instrument(skip_all)] +async fn two_first_letter_headers( + method: Method, + host: Host, + cookies: CookieJar, + headers: HeaderMap, + State(api_impl): State, +) -> Result +where + I: AsRef + Send + Sync, + A: apis::default::Default, +{ + // Header parameters + let header_params = { + let header_x_header_one = headers.get(HeaderName::from_static("x_header_one")); + + let header_x_header_one = match header_x_header_one { + Some(v) => match header::IntoHeaderValue::::try_from((*v).clone()) { + Ok(result) => Some(result.0), + Err(err) => { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header x-header-one - {}", err))) + .map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }); + } + }, + None => None, + }; + let header_x_header_two = headers.get(HeaderName::from_static("x_header_two")); + + let header_x_header_two = match header_x_header_two { + Some(v) => match header::IntoHeaderValue::::try_from((*v).clone()) { + Ok(result) => Some(result.0), + Err(err) => { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header x-header-two - {}", err))) + .map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }); + } + }, + None => None, + }; + + models::TwoFirstLetterHeadersHeaderParams { + x_header_one: header_x_header_one, + x_header_two: header_x_header_two, + } + }; + + let validation = two_first_letter_headers_validation(header_params); + + let Ok((header_params,)) = validation else { + return Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(validation.unwrap_err().to_string())) + .map_err(|_| StatusCode::BAD_REQUEST); + }; + + let result = api_impl + .as_ref() + .two_first_letter_headers(method, host, cookies, header_params) + .await; + + let mut response = Response::builder(); + + let resp = match result { + Ok(rsp) => match rsp { + apis::default::TwoFirstLetterHeadersResponse::Status200_OK => { + let mut response = response.status(200); + response.body(Body::empty()) + } + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.status(500).body(Body::empty()) + } + }; + + resp.map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) +} + #[derive(validator::Validate)] #[allow(dead_code)] struct UntypedPropertyGetBodyValidator<'a> { diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/types.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/types.rs index 1c59471ea54..57a48986f26 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/types.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use openapi_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use openapi_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/README.md b/samples/server/petstore/rust-axum/output/ops-v3/README.md index 90792c9ce7c..cff61b75e56 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/README.md +++ b/samples/server/petstore/rust-axum/output/ops-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/src/types.rs b/samples/server/petstore/rust-axum/output/ops-v3/src/types.rs index 98c3d7a00cd..6b0bc059787 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/src/types.rs +++ b/samples/server/petstore/rust-axum/output/ops-v3/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use ops_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use ops_v3::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md index a2e1c2ad4cb..dfeabcd3e07 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/types.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/types.rs index c17c655d720..108471d6fab 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/types.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use petstore_with_fake_endpoints_models_for_testing::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use petstore_with_fake_endpoints_models_for_testing::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/README.md b/samples/server/petstore/rust-axum/output/petstore/README.md index c6dc92709b7..57f4554ba18 100644 --- a/samples/server/petstore/rust-axum/output/petstore/README.md +++ b/samples/server/petstore/rust-axum/output/petstore/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/src/types.rs b/samples/server/petstore/rust-axum/output/petstore/src/types.rs index eca60521b9a..3993dac5843 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/types.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use petstore::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use petstore::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md index 01b4c91fa03..8cd88c02ecf 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/types.rs b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/types.rs index 391471861d0..8337a8139d5 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/types.rs +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use ping_bearer_auth::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use ping_bearer_auth::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md index b26f35abd83..e7753c376ae 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.1.9 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs index aac11a86f4d..03e061b4399 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_axum_header_uui::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_axum_header_uui::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md index 4f4f5774baa..f33c5dc7c31 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 2.3.4 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/src/types.rs b/samples/server/petstore/rust-axum/output/rust-axum-test/src/types.rs index cebc173ddf8..60b6bc07642 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/src/types.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_server_test::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_server_test::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION index 7e7b8b9bc73..17f2442ff3b 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0-SNAPSHOT +7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md index e0e8006366b..40d7622db2f 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.7.0-SNAPSHOT +- Generator version: 7.9.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs index 7f2bc396ccf..fafa1faa28b 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/types.rs @@ -175,7 +175,7 @@ impl Nullable { /// assert_eq!(x.expect("the world is ending"), "value"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_axum_validation_test::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null; @@ -210,7 +210,7 @@ impl Nullable { /// assert_eq!(x.unwrap(), "air"); /// ``` /// - /// ```{.should_panic} + /// ```should_panic /// # use rust_axum_validation_test::types::Nullable; /// /// let x: Nullable<&str> = Nullable::Null;