Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ pub trait {{classnamePascalCase}}<E: std::fmt::Debug + Send + Sync + 'static = (
{{/x-consumes-multipart}}
{{/x-consumes-multipart-related}}
{{#x-consumes-multipart}}
body: &Multipart,
body: Multipart,
{{/x-consumes-multipart}}
{{#x-consumes-multipart-related}}
body: &axum::body::Body,
body: axum::body::Body,
{{/x-consumes-multipart-related}}
) -> Result<{{{operationId}}}Response, E>;
{{/vendorExtensions}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ where
{{/x-consumes-multipart}}
{{/x-consumes-multipart-related}}
{{#x-consumes-multipart}}
&body,
body,
{{/x-consumes-multipart}}
{{#x-consumes-multipart-related}}
&body,
body,
{{/x-consumes-multipart-related}}
{{/vendorExtensions}}
).await;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0-SNAPSHOT
7.12.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,6 @@ pub trait CookieAuthentication {
) -> Option<Self::Claims>;
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum BasicAuthKind {
Basic,
Bearer,
}

/// API Key Authentication - Authentication Header.
/// For `Basic token` and `Bearer token`
#[async_trait::async_trait]
pub trait ApiAuthBasic {
type Claims;

/// Extracting Claims from Header. Return None if the Claims are invalid.
async fn extract_claims_from_auth_header(
&self,
kind: BasicAuthKind,
headers: &axum::http::header::HeaderMap,
key: &str,
) -> Option<Self::Claims>;
}

// Error handler for unhandled errors.
#[async_trait::async_trait]
pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub trait Payments<E: std::fmt::Debug + Send + Sync + 'static = ()>:
method: &Method,
host: &Host,
cookies: &CookieJar,
claims: &Self::Claims,
path_params: &models::GetPaymentMethodByIdPathParams,
) -> Result<GetPaymentMethodByIdResponse, E>;

Expand All @@ -63,7 +62,6 @@ pub trait Payments<E: std::fmt::Debug + Send + Sync + 'static = ()>:
method: &Method,
host: &Host,
cookies: &CookieJar,
claims: &Self::Claims,
) -> Result<GetPaymentMethodsResponse, E>;

/// Make a payment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
get(get_payment_methods::<I, A, E, C>),
)
.route(
"/v71/paymentMethods/{id}",
"/v71/paymentMethods/:id",
get(get_payment_method_by_id::<I, A, E, C>),
)
.route("/v71/payments", post(post_make_payment::<I, A, E, C>))
Expand All @@ -55,28 +55,14 @@ async fn get_payment_method_by_id<I, A, E, C>(
method: Method,
host: Host,
cookies: CookieJar,
headers: HeaderMap,
Path(path_params): Path<models::GetPaymentMethodByIdPathParams>,
State(api_impl): State<I>,
) -> Result<Response, StatusCode>
where
I: AsRef<A> + Send + Sync,
A: apis::payments::Payments<E, Claims = C> + apis::ApiAuthBasic<Claims = C> + Send + Sync,
A: apis::payments::Payments<E, Claims = C> + Send + Sync,
E: std::fmt::Debug + Send + Sync + 'static,
{
// Authentication
let claims_in_auth_header = api_impl
.as_ref()
.extract_claims_from_auth_header(apis::BasicAuthKind::Bearer, &headers, "authorization")
.await;
let claims = None.or(claims_in_auth_header);
let Some(claims) = claims else {
return Response::builder()
.status(StatusCode::UNAUTHORIZED)
.body(Body::empty())
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
};

#[allow(clippy::redundant_closure)]
let validation =
tokio::task::spawn_blocking(move || get_payment_method_by_id_validation(path_params))
Expand All @@ -92,7 +78,7 @@ where

let result = api_impl
.as_ref()
.get_payment_method_by_id(&method, &host, &cookies, &claims, &path_params)
.get_payment_method_by_id(&method, &host, &cookies, &path_params)
.await;

let mut response = Response::builder();
Expand Down Expand Up @@ -172,27 +158,13 @@ async fn get_payment_methods<I, A, E, C>(
method: Method,
host: Host,
cookies: CookieJar,
headers: HeaderMap,
State(api_impl): State<I>,
) -> Result<Response, StatusCode>
where
I: AsRef<A> + Send + Sync,
A: apis::payments::Payments<E, Claims = C> + apis::ApiAuthBasic<Claims = C> + Send + Sync,
A: apis::payments::Payments<E, Claims = C> + Send + Sync,
E: std::fmt::Debug + Send + Sync + 'static,
{
// Authentication
let claims_in_auth_header = api_impl
.as_ref()
.extract_claims_from_auth_header(apis::BasicAuthKind::Bearer, &headers, "authorization")
.await;
let claims = None.or(claims_in_auth_header);
let Some(claims) = claims else {
return Response::builder()
.status(StatusCode::UNAUTHORIZED)
.body(Body::empty())
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
};

#[allow(clippy::redundant_closure)]
let validation = tokio::task::spawn_blocking(move || get_payment_methods_validation())
.await
Expand All @@ -207,7 +179,7 @@ where

let result = api_impl
.as_ref()
.get_payment_methods(&method, &host, &cookies, &claims)
.get_payment_methods(&method, &host, &cookies)
.await;

let mut response = Response::builder();
Expand Down Expand Up @@ -278,15 +250,13 @@ async fn post_make_payment<I, A, E, C>(
method: Method,
host: Host,
cookies: CookieJar,
headers: HeaderMap,
State(api_impl): State<I>,
Json(body): Json<Option<models::Payment>>,
) -> Result<Response, StatusCode>
where
I: AsRef<A> + Send + Sync,
A: apis::payments::Payments<E, Claims = C>
+ apis::CookieAuthentication<Claims = C>
+ apis::ApiAuthBasic<Claims = C>
+ Send
+ Sync,
E: std::fmt::Debug + Send + Sync + 'static,
Expand All @@ -296,11 +266,7 @@ where
.as_ref()
.extract_claims_from_cookie(&cookies, "X-API-Key")
.await;
let claims_in_auth_header = api_impl
.as_ref()
.extract_claims_from_auth_header(apis::BasicAuthKind::Bearer, &headers, "authorization")
.await;
let claims = None.or(claims_in_cookie).or(claims_in_auth_header);
let claims = None.or(claims_in_cookie);
let Some(claims) = claims else {
return Response::builder()
.status(StatusCode::UNAUTHORIZED)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0-SNAPSHOT
7.12.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
method: &Method,
host: &Host,
cookies: &CookieJar,
body: &axum::body::Body,
body: axum::body::Body,
) -> Result<MultipartRelatedRequestPostResponse, E>;

/// MultipartRequestPost - POST /multipart_request
Expand All @@ -50,7 +50,7 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
method: &Method,
host: &Host,
cookies: &CookieJar,
body: &Multipart,
body: Multipart,
) -> Result<MultipartRequestPostResponse, E>;

/// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types
Expand All @@ -59,6 +59,6 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
method: &Method,
host: &Host,
cookies: &CookieJar,
body: &axum::body::Body,
body: axum::body::Body,
) -> Result<MultipleIdenticalMimeTypesPostResponse, E>;
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0-SNAPSHOT
7.12.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
.route("/complex-query-param",
get(complex_query_param_get::<I, A, E>)
)
.route("/enum_in_path/{path_param}",
.route("/enum_in_path/:path_param",
get(enum_in_path_path_param_get::<I, A, E>)
)
.route("/form-test",
Expand All @@ -56,7 +56,7 @@ where
.route("/multiget",
get(multiget_get::<I, A, E>)
)
.route("/multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b}",
.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::<I, A, E>)
)
.route("/multiple_auth_scheme",
Expand All @@ -83,7 +83,7 @@ where
.route("/repos",
post(create_repo::<I, A, E>)
)
.route("/repos/{repo_id}",
.route("/repos/:repo_id",
get(get_repo_info::<I, A, E>).get(get_repo_info::<I, A, E>)
)
.route("/required_octet_stream",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0-SNAPSHOT
7.12.0-SNAPSHOT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please merge the latest master (upstream official) to your branch, build the CLI JAR locally and regenerate the samples again?

2 changes: 1 addition & 1 deletion samples/server/petstore/rust-axum/output/ops-v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0-SNAPSHOT
7.12.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.0-SNAPSHOT
- Generator version: 7.12.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ pub enum TestJsonFormDataResponse {
#[async_trait]
#[allow(clippy::ptr_arg)]
pub trait Fake<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::ErrorHandler<E> {
type Claims;

/// Call123example - GET /v2/fake/operation-with-numeric-id
async fn call123example(
&self,
Expand Down Expand Up @@ -211,7 +209,6 @@ pub trait Fake<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::ErrorHan
method: &Method,
host: &Host,
cookies: &CookieJar,
claims: &Self::Claims,
body: &models::TestEndpointParametersRequest,
) -> Result<TestEndpointParametersResponse, E>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,6 @@ pub trait ApiKeyAuthHeader {
) -> Option<Self::Claims>;
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum BasicAuthKind {
Basic,
Bearer,
}

/// API Key Authentication - Authentication Header.
/// For `Basic token` and `Bearer token`
#[async_trait::async_trait]
pub trait ApiAuthBasic {
type Claims;

/// Extracting Claims from Header. Return None if the Claims are invalid.
async fn extract_claims_from_auth_header(
&self,
kind: BasicAuthKind,
headers: &axum::http::header::HeaderMap,
key: &str,
) -> Option<Self::Claims>;
}

// Error handler for unhandled errors.
#[async_trait::async_trait]
pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ pub trait Pet<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::ErrorHand
host: &Host,
cookies: &CookieJar,
path_params: &models::UploadFilePathParams,
body: &Multipart,
body: Multipart,
) -> Result<UploadFileResponse, E>;
}
Loading
Loading