Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust-Axum] [Breaking Changes] Prevent Operation response with internal Error #20047

Merged
merged 2 commits into from
Nov 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub trait {{classnamePascalCase}} {
{{#x-consumes-multipart-related}}
body: axum::body::Body,
{{/x-consumes-multipart-related}}
) -> Result<{{{operationId}}}Response, String>;
) -> Result<{{{operationId}}}Response, ()>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kindly ping @wing328 to review

This is interface/trait update. The other changed-files are generated samples.

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the heads-up

if users need a way to rollback, we can then provide an option or the users can simply use custom templates for the time being.

{{/vendorExtensions}}
{{^-last}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub trait Payments {
host: Host,
cookies: CookieJar,
path_params: models::GetPaymentMethodByIdPathParams,
) -> Result<GetPaymentMethodByIdResponse, String>;
) -> Result<GetPaymentMethodByIdResponse, ()>;

/// Get payment methods.
///
Expand All @@ -58,7 +58,7 @@ pub trait Payments {
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<GetPaymentMethodsResponse, String>;
) -> Result<GetPaymentMethodsResponse, ()>;

/// Make a payment.
///
Expand All @@ -70,5 +70,5 @@ pub trait Payments {
cookies: CookieJar,
token_in_cookie: Option<String>,
body: Option<models::Payment>,
) -> Result<PostMakePaymentResponse, String>;
) -> Result<PostMakePaymentResponse, ()>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: axum::body::Body,
) -> Result<MultipartRelatedRequestPostResponse, String>;
) -> Result<MultipartRelatedRequestPostResponse, ()>;

/// MultipartRequestPost - POST /multipart_request
async fn multipart_request_post(
Expand All @@ -51,7 +51,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Multipart,
) -> Result<MultipartRequestPostResponse, String>;
) -> Result<MultipartRequestPostResponse, ()>;

/// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types
async fn multiple_identical_mime_types_post(
Expand All @@ -60,5 +60,5 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: axum::body::Body,
) -> Result<MultipleIdenticalMimeTypesPostResponse, String>;
) -> Result<MultipleIdenticalMimeTypesPostResponse, ()>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::AnyOfGetQueryParams,
) -> Result<AnyOfGetResponse, String>;
) -> Result<AnyOfGetResponse, ()>;

/// CallbackWithHeaderPost - POST /callback-with-header
async fn callback_with_header_post(
Expand All @@ -291,7 +291,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::CallbackWithHeaderPostQueryParams,
) -> Result<CallbackWithHeaderPostResponse, String>;
) -> Result<CallbackWithHeaderPostResponse, ()>;

/// ComplexQueryParamGet - GET /complex-query-param
async fn complex_query_param_get(
Expand All @@ -300,7 +300,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::ComplexQueryParamGetQueryParams,
) -> Result<ComplexQueryParamGetResponse, String>;
) -> Result<ComplexQueryParamGetResponse, ()>;

/// EnumInPathPathParamGet - GET /enum_in_path/{path_param}
async fn enum_in_path_path_param_get(
Expand All @@ -309,7 +309,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
path_params: models::EnumInPathPathParamGetPathParams,
) -> Result<EnumInPathPathParamGetResponse, String>;
) -> Result<EnumInPathPathParamGetResponse, ()>;

/// Test a Form Post.
///
Expand All @@ -320,7 +320,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: models::FormTestRequest,
) -> Result<FormTestResponse, String>;
) -> Result<FormTestResponse, ()>;

/// GetWithBooleanParameter - GET /get-with-bool
async fn get_with_boolean_parameter(
Expand All @@ -329,7 +329,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::GetWithBooleanParameterQueryParams,
) -> Result<GetWithBooleanParameterResponse, String>;
) -> Result<GetWithBooleanParameterResponse, ()>;

/// JsonComplexQueryParamGet - GET /json-complex-query-param
async fn json_complex_query_param_get(
Expand All @@ -338,7 +338,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::JsonComplexQueryParamGetQueryParams,
) -> Result<JsonComplexQueryParamGetResponse, String>;
) -> Result<JsonComplexQueryParamGetResponse, ()>;

/// MandatoryRequestHeaderGet - GET /mandatory-request-header
async fn mandatory_request_header_get(
Expand All @@ -347,15 +347,15 @@ pub trait Default {
host: Host,
cookies: CookieJar,
header_params: models::MandatoryRequestHeaderGetHeaderParams,
) -> Result<MandatoryRequestHeaderGetResponse, String>;
) -> Result<MandatoryRequestHeaderGetResponse, ()>;

/// MergePatchJsonGet - GET /merge-patch-json
async fn merge_patch_json_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<MergePatchJsonGetResponse, String>;
) -> Result<MergePatchJsonGetResponse, ()>;

/// Get some stuff..
///
Expand All @@ -365,15 +365,15 @@ pub trait Default {
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<MultigetGetResponse, String>;
) -> Result<MultigetGetResponse, ()>;

/// MultipleAuthSchemeGet - GET /multiple_auth_scheme
async fn multiple_auth_scheme_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<MultipleAuthSchemeGetResponse, String>;
) -> Result<MultipleAuthSchemeGetResponse, ()>;

/// 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(
Expand All @@ -382,26 +382,23 @@ pub trait Default {
host: Host,
cookies: CookieJar,
path_params: models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams,
) -> Result<
MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse,
String,
>;
) -> Result<MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse, ()>;

/// OneOfGet - GET /one-of
async fn one_of_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<OneOfGetResponse, String>;
) -> Result<OneOfGetResponse, ()>;

/// OverrideServerGet - GET /override-server
async fn override_server_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<OverrideServerGetResponse, String>;
) -> Result<OverrideServerGetResponse, ()>;

/// Get some stuff with parameters..
///
Expand All @@ -412,15 +409,15 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::ParamgetGetQueryParams,
) -> Result<ParamgetGetResponse, String>;
) -> Result<ParamgetGetResponse, ()>;

/// ReadonlyAuthSchemeGet - GET /readonly_auth_scheme
async fn readonly_auth_scheme_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<ReadonlyAuthSchemeGetResponse, String>;
) -> Result<ReadonlyAuthSchemeGetResponse, ()>;

/// RegisterCallbackPost - POST /register-callback
async fn register_callback_post(
Expand All @@ -429,7 +426,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
query_params: models::RegisterCallbackPostQueryParams,
) -> Result<RegisterCallbackPostResponse, String>;
) -> Result<RegisterCallbackPostResponse, ()>;

/// RequiredOctetStreamPut - PUT /required_octet_stream
async fn required_octet_stream_put(
Expand All @@ -438,23 +435,23 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<RequiredOctetStreamPutResponse, String>;
) -> Result<RequiredOctetStreamPutResponse, ()>;

/// ResponsesWithHeadersGet - GET /responses_with_headers
async fn responses_with_headers_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<ResponsesWithHeadersGetResponse, String>;
) -> Result<ResponsesWithHeadersGetResponse, ()>;

/// Rfc7807Get - GET /rfc7807
async fn rfc7807_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<Rfc7807GetResponse, String>;
) -> Result<Rfc7807GetResponse, ()>;

/// TwoFirstLetterHeaders - POST /operation-two-first-letter-headers
async fn two_first_letter_headers(
Expand All @@ -463,7 +460,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
header_params: models::TwoFirstLetterHeadersHeaderParams,
) -> Result<TwoFirstLetterHeadersResponse, String>;
) -> Result<TwoFirstLetterHeadersResponse, ()>;

/// UntypedPropertyGet - GET /untyped_property
async fn untyped_property_get(
Expand All @@ -472,15 +469,15 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Option<models::ObjectUntypedProps>,
) -> Result<UntypedPropertyGetResponse, String>;
) -> Result<UntypedPropertyGetResponse, ()>;

/// UuidGet - GET /uuid
async fn uuid_get(
&self,
method: Method,
host: Host,
cookies: CookieJar,
) -> Result<UuidGetResponse, String>;
) -> Result<UuidGetResponse, ()>;

/// XmlExtraPost - POST /xml_extra
async fn xml_extra_post(
Expand All @@ -489,7 +486,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<XmlExtraPostResponse, String>;
) -> Result<XmlExtraPostResponse, ()>;

/// XmlOtherPost - POST /xml_other
async fn xml_other_post(
Expand All @@ -498,7 +495,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<XmlOtherPostResponse, String>;
) -> Result<XmlOtherPostResponse, ()>;

/// XmlOtherPut - PUT /xml_other
async fn xml_other_put(
Expand All @@ -507,7 +504,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<XmlOtherPutResponse, String>;
) -> Result<XmlOtherPutResponse, ()>;

/// Post an array. It's important we test apostrophes, so include one here..
///
Expand All @@ -518,7 +515,7 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<XmlPostResponse, String>;
) -> Result<XmlPostResponse, ()>;

/// XmlPut - PUT /xml
async fn xml_put(
Expand All @@ -527,5 +524,5 @@ pub trait Default {
host: Host,
cookies: CookieJar,
body: Bytes,
) -> Result<XmlPutResponse, String>;
) -> Result<XmlPutResponse, ()>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ pub trait InfoRepo {
host: Host,
cookies: CookieJar,
path_params: models::GetRepoInfoPathParams,
) -> Result<GetRepoInfoResponse, String>;
) -> Result<GetRepoInfoResponse, ()>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ pub trait Repo {
host: Host,
cookies: CookieJar,
body: models::ObjectParam,
) -> Result<CreateRepoResponse, String>;
) -> Result<CreateRepoResponse, ()>;
}
Loading
Loading