Skip to content

Commit 1f8787e

Browse files
fix: update axum generated multipart requests to own the body (#21301)
* fix: update axum generated multipart requests to own the Multipart or Body Notes: &Multipart cannot access fields, as we need mutable access. * chore: run the updated rust-axum sample * chore: run the updated rust-axum sample (2) Notes: Ran ./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit * chore: fix inconsistent lifetimes Notes: Multipart should be owned; normal request remains borrowed * chore: rerun axum samples
1 parent 1b57d4b commit 1f8787e

File tree

33 files changed

+38
-39
lines changed

33 files changed

+38
-39
lines changed

modules/openapi-generator/src/main/resources/rust-axum/apis.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ pub trait {{classnamePascalCase}}<E: std::fmt::Debug + Send + Sync + 'static = (
6868
{{/x-consumes-multipart}}
6969
{{/x-consumes-multipart-related}}
7070
{{#x-consumes-multipart}}
71-
body: &Multipart,
71+
body: Multipart,
7272
{{/x-consumes-multipart}}
7373
{{#x-consumes-multipart-related}}
74-
body: &axum::body::Body,
74+
body: axum::body::Body,
7575
{{/x-consumes-multipart-related}}
7676
) -> Result<{{{operationId}}}Response, E>;
7777
{{/vendorExtensions}}

modules/openapi-generator/src/main/resources/rust-axum/server-operation.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ where
226226
{{/x-consumes-multipart}}
227227
{{/x-consumes-multipart-related}}
228228
{{#x-consumes-multipart}}
229-
&body,
229+
body,
230230
{{/x-consumes-multipart}}
231231
{{#x-consumes-multipart-related}}
232-
&body,
232+
body,
233233
{{/x-consumes-multipart-related}}
234234
{{/vendorExtensions}}
235235
).await;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.13.0-SNAPSHOT
1+
7.14.0-SNAPSHOT

samples/server/petstore/rust-axum/output/apikey-auths/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
1212
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
1313

1414
- API version: 1.0.0
15-
- Generator version: 7.13.0-SNAPSHOT
15+
- Generator version: 7.14.0-SNAPSHOT
1616

1717

1818

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.13.0-SNAPSHOT
1+
7.14.0-SNAPSHOT

samples/server/petstore/rust-axum/output/multipart-v3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
1212
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
1313

1414
- API version: 1.0.7
15-
- Generator version: 7.13.0-SNAPSHOT
15+
- Generator version: 7.14.0-SNAPSHOT
1616

1717

1818

samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
4141
method: &Method,
4242
host: &Host,
4343
cookies: &CookieJar,
44-
body: &axum::body::Body,
44+
body: axum::body::Body,
4545
) -> Result<MultipartRelatedRequestPostResponse, E>;
4646

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

5656
/// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types
@@ -59,6 +59,6 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
5959
method: &Method,
6060
host: &Host,
6161
cookies: &CookieJar,
62-
body: &axum::body::Body,
62+
body: axum::body::Body,
6363
) -> Result<MultipleIdenticalMimeTypesPostResponse, E>;
6464
}

samples/server/petstore/rust-axum/output/multipart-v3/src/server/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ where
6969

7070
let result = api_impl
7171
.as_ref()
72-
.multipart_related_request_post(&method, &host, &cookies, &body)
72+
.multipart_related_request_post(&method, &host, &cookies, body)
7373
.await;
7474

7575
let mut response = Response::builder();
@@ -129,7 +129,7 @@ where
129129

130130
let result = api_impl
131131
.as_ref()
132-
.multipart_request_post(&method, &host, &cookies, &body)
132+
.multipart_request_post(&method, &host, &cookies, body)
133133
.await;
134134

135135
let mut response = Response::builder();
@@ -190,7 +190,7 @@ where
190190

191191
let result = api_impl
192192
.as_ref()
193-
.multiple_identical_mime_types_post(&method, &host, &cookies, &body)
193+
.multiple_identical_mime_types_post(&method, &host, &cookies, body)
194194
.await;
195195

196196
let mut response = Response::builder();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.13.0-SNAPSHOT
1+
7.14.0-SNAPSHOT

samples/server/petstore/rust-axum/output/openapi-v3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
1212
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
1313

1414
- API version: 1.0.7
15-
- Generator version: 7.13.0-SNAPSHOT
15+
- Generator version: 7.14.0-SNAPSHOT
1616

1717

1818

0 commit comments

Comments
 (0)