Skip to content

Commit 37f3e75

Browse files
Commit the changes to the generated rust code with the new feature
1 parent 4454b78 commit 37f3e75

File tree

69 files changed

+1066
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1066
-697
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.16.0-SNAPSHOT
1+
7.17.0-SNAPSHOT

samples/server/petstore/rust-axum/output/apikey-authorization/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true }
3030
frunk-enum-derive = { version = "0.3", optional = true }
3131
frunk_core = { version = "0.4", optional = true }
3232
frunk_derives = { version = "0.4", optional = true }
33+
futures = "0.3.31"
3334
http = "1"
3435
lazy_static = "1"
3536
regex = "1"

samples/server/petstore/rust-axum/output/apikey-authorization/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.16.0-SNAPSHOT
15+
- Generator version: 7.17.0-SNAPSHOT
1616

1717

1818

samples/server/petstore/rust-axum/output/apikey-authorization/src/apis/payments.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ use serde::{Deserialize, Serialize};
77

88
use crate::{models, types::*};
99

10-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
10+
#[derive(Debug)]
1111
#[must_use]
1212
#[allow(clippy::large_enum_variant)]
1313
pub enum GetPaymentMethodByIdResponse {
14-
/// OK - the request has succeeded.
15-
Status200_OK(models::PaymentMethod),
16-
/// Unprocessable Entity - a request validation error.
17-
Status422_UnprocessableEntity(models::CheckoutError),
14+
/// OK - the request has succeeded. (application/json)
15+
Status200_OK_Json(models::PaymentMethod),
16+
/// Unprocessable Entity - a request validation error. (application/json)
17+
Status422_UnprocessableEntity_Json(models::CheckoutError),
1818
}
1919

20-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
20+
#[derive(Debug)]
2121
#[must_use]
2222
#[allow(clippy::large_enum_variant)]
2323
pub enum GetPaymentMethodsResponse {
24-
/// OK - the request has succeeded.
25-
Status200_OK(Vec<models::PaymentMethod>),
24+
/// OK - the request has succeeded. (application/json)
25+
Status200_OK_Json(Vec<models::PaymentMethod>),
2626
}
2727

28-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
28+
#[derive(Debug)]
2929
#[must_use]
3030
#[allow(clippy::large_enum_variant)]
3131
pub enum PostMakePaymentResponse {
32-
/// OK - the request has succeeded.
33-
Status200_OK(models::PaymentResult),
34-
/// Unprocessable Entity - a request validation error.
35-
Status422_UnprocessableEntity(models::CheckoutError),
32+
/// OK - the request has succeeded. (application/json)
33+
Status200_OK_Json(models::PaymentResult),
34+
/// Unprocessable Entity - a request validation error. (application/json)
35+
Status422_UnprocessableEntity_Json(models::CheckoutError),
3636
}
3737

3838
/// Payments APIs - Authorization.

samples/server/petstore/rust-axum/output/apikey-authorization/src/server/mod.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ where
123123

124124
let resp = match result {
125125
Ok(rsp) => match rsp {
126-
apis::payments::GetPaymentMethodByIdResponse::Status200_OK(body) => {
126+
apis::payments::GetPaymentMethodByIdResponse::Status200_OK_Json(body) => {
127127
let mut response = response.status(200);
128128
{
129129
let mut response_headers = response.headers_mut().unwrap();
130130
response_headers
131131
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
132132
}
133-
133+
let body_clone = body.clone();
134134
let body_content = tokio::task::spawn_blocking(move || {
135-
serde_json::to_vec(&body).map_err(|e| {
135+
serde_json::to_vec(&body_clone).map_err(|e| {
136136
error!(error = ?e);
137137
StatusCode::INTERNAL_SERVER_ERROR
138138
})
@@ -141,16 +141,18 @@ where
141141
.unwrap()?;
142142
response.body(Body::from(body_content))
143143
}
144-
apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity(body) => {
144+
apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity_Json(
145+
body,
146+
) => {
145147
let mut response = response.status(422);
146148
{
147149
let mut response_headers = response.headers_mut().unwrap();
148150
response_headers
149151
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
150152
}
151-
153+
let body_clone = body.clone();
152154
let body_content = tokio::task::spawn_blocking(move || {
153-
serde_json::to_vec(&body).map_err(|e| {
155+
serde_json::to_vec(&body_clone).map_err(|e| {
154156
error!(error = ?e);
155157
StatusCode::INTERNAL_SERVER_ERROR
156158
})
@@ -276,16 +278,16 @@ where
276278

277279
let resp = match result {
278280
Ok(rsp) => match rsp {
279-
apis::payments::GetPaymentMethodsResponse::Status200_OK(body) => {
281+
apis::payments::GetPaymentMethodsResponse::Status200_OK_Json(body) => {
280282
let mut response = response.status(200);
281283
{
282284
let mut response_headers = response.headers_mut().unwrap();
283285
response_headers
284286
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
285287
}
286-
288+
let body_clone = body.clone();
287289
let body_content = tokio::task::spawn_blocking(move || {
288-
serde_json::to_vec(&body).map_err(|e| {
290+
serde_json::to_vec(&body_clone).map_err(|e| {
289291
error!(error = ?e);
290292
StatusCode::INTERNAL_SERVER_ERROR
291293
})
@@ -431,16 +433,16 @@ where
431433

432434
let resp = match result {
433435
Ok(rsp) => match rsp {
434-
apis::payments::PostMakePaymentResponse::Status200_OK(body) => {
436+
apis::payments::PostMakePaymentResponse::Status200_OK_Json(body) => {
435437
let mut response = response.status(200);
436438
{
437439
let mut response_headers = response.headers_mut().unwrap();
438440
response_headers
439441
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
440442
}
441-
443+
let body_clone = body.clone();
442444
let body_content = tokio::task::spawn_blocking(move || {
443-
serde_json::to_vec(&body).map_err(|e| {
445+
serde_json::to_vec(&body_clone).map_err(|e| {
444446
error!(error = ?e);
445447
StatusCode::INTERNAL_SERVER_ERROR
446448
})
@@ -449,16 +451,16 @@ where
449451
.unwrap()?;
450452
response.body(Body::from(body_content))
451453
}
452-
apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity(body) => {
454+
apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity_Json(body) => {
453455
let mut response = response.status(422);
454456
{
455457
let mut response_headers = response.headers_mut().unwrap();
456458
response_headers
457459
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
458460
}
459-
461+
let body_clone = body.clone();
460462
let body_content = tokio::task::spawn_blocking(move || {
461-
serde_json::to_vec(&body).map_err(|e| {
463+
serde_json::to_vec(&body_clone).map_err(|e| {
462464
error!(error = ?e);
463465
StatusCode::INTERNAL_SERVER_ERROR
464466
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.16.0-SNAPSHOT
1+
7.17.0-SNAPSHOT

samples/server/petstore/rust-axum/output/apikey-auths/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true }
3030
frunk-enum-derive = { version = "0.3", optional = true }
3131
frunk_core = { version = "0.4", optional = true }
3232
frunk_derives = { version = "0.4", optional = true }
33+
futures = "0.3.31"
3334
http = "1"
3435
lazy_static = "1"
3536
regex = "1"

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.16.0-SNAPSHOT
15+
- Generator version: 7.17.0-SNAPSHOT
1616

1717

1818

samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ use serde::{Deserialize, Serialize};
77

88
use crate::{models, types::*};
99

10-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
10+
#[derive(Debug)]
1111
#[must_use]
1212
#[allow(clippy::large_enum_variant)]
1313
pub enum GetPaymentMethodByIdResponse {
14-
/// OK - the request has succeeded.
15-
Status200_OK(models::PaymentMethod),
16-
/// Unprocessable Entity - a request validation error.
17-
Status422_UnprocessableEntity(models::CheckoutError),
14+
/// OK - the request has succeeded. (application/json)
15+
Status200_OK_Json(models::PaymentMethod),
16+
/// Unprocessable Entity - a request validation error. (application/json)
17+
Status422_UnprocessableEntity_Json(models::CheckoutError),
1818
}
1919

20-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
20+
#[derive(Debug)]
2121
#[must_use]
2222
#[allow(clippy::large_enum_variant)]
2323
pub enum GetPaymentMethodsResponse {
24-
/// OK - the request has succeeded.
25-
Status200_OK(Vec<models::PaymentMethod>),
24+
/// OK - the request has succeeded. (application/json)
25+
Status200_OK_Json(Vec<models::PaymentMethod>),
2626
}
2727

28-
#[derive(Debug, PartialEq, Serialize, Deserialize)]
28+
#[derive(Debug)]
2929
#[must_use]
3030
#[allow(clippy::large_enum_variant)]
3131
pub enum PostMakePaymentResponse {
32-
/// OK - the request has succeeded.
33-
Status200_OK(models::PaymentResult),
34-
/// Unprocessable Entity - a request validation error.
35-
Status422_UnprocessableEntity(models::CheckoutError),
32+
/// OK - the request has succeeded. (application/json)
33+
Status200_OK_Json(models::PaymentResult),
34+
/// Unprocessable Entity - a request validation error. (application/json)
35+
Status422_UnprocessableEntity_Json(models::CheckoutError),
3636
}
3737

3838
/// Payments

samples/server/petstore/rust-axum/output/apikey-auths/src/server/mod.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ where
9696

9797
let resp = match result {
9898
Ok(rsp) => match rsp {
99-
apis::payments::GetPaymentMethodByIdResponse::Status200_OK(body) => {
99+
apis::payments::GetPaymentMethodByIdResponse::Status200_OK_Json(body) => {
100100
let mut response = response.status(200);
101101
{
102102
let mut response_headers = response.headers_mut().unwrap();
103103
response_headers
104104
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
105105
}
106-
106+
let body_clone = body.clone();
107107
let body_content = tokio::task::spawn_blocking(move || {
108-
serde_json::to_vec(&body).map_err(|e| {
108+
serde_json::to_vec(&body_clone).map_err(|e| {
109109
error!(error = ?e);
110110
StatusCode::INTERNAL_SERVER_ERROR
111111
})
@@ -114,16 +114,18 @@ where
114114
.unwrap()?;
115115
response.body(Body::from(body_content))
116116
}
117-
apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity(body) => {
117+
apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity_Json(
118+
body,
119+
) => {
118120
let mut response = response.status(422);
119121
{
120122
let mut response_headers = response.headers_mut().unwrap();
121123
response_headers
122124
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
123125
}
124-
126+
let body_clone = body.clone();
125127
let body_content = tokio::task::spawn_blocking(move || {
126-
serde_json::to_vec(&body).map_err(|e| {
128+
serde_json::to_vec(&body_clone).map_err(|e| {
127129
error!(error = ?e);
128130
StatusCode::INTERNAL_SERVER_ERROR
129131
})
@@ -198,16 +200,16 @@ where
198200

199201
let resp = match result {
200202
Ok(rsp) => match rsp {
201-
apis::payments::GetPaymentMethodsResponse::Status200_OK(body) => {
203+
apis::payments::GetPaymentMethodsResponse::Status200_OK_Json(body) => {
202204
let mut response = response.status(200);
203205
{
204206
let mut response_headers = response.headers_mut().unwrap();
205207
response_headers
206208
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
207209
}
208-
210+
let body_clone = body.clone();
209211
let body_content = tokio::task::spawn_blocking(move || {
210-
serde_json::to_vec(&body).map_err(|e| {
212+
serde_json::to_vec(&body_clone).map_err(|e| {
211213
error!(error = ?e);
212214
StatusCode::INTERNAL_SERVER_ERROR
213215
})
@@ -305,16 +307,16 @@ where
305307

306308
let resp = match result {
307309
Ok(rsp) => match rsp {
308-
apis::payments::PostMakePaymentResponse::Status200_OK(body) => {
310+
apis::payments::PostMakePaymentResponse::Status200_OK_Json(body) => {
309311
let mut response = response.status(200);
310312
{
311313
let mut response_headers = response.headers_mut().unwrap();
312314
response_headers
313315
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
314316
}
315-
317+
let body_clone = body.clone();
316318
let body_content = tokio::task::spawn_blocking(move || {
317-
serde_json::to_vec(&body).map_err(|e| {
319+
serde_json::to_vec(&body_clone).map_err(|e| {
318320
error!(error = ?e);
319321
StatusCode::INTERNAL_SERVER_ERROR
320322
})
@@ -323,16 +325,16 @@ where
323325
.unwrap()?;
324326
response.body(Body::from(body_content))
325327
}
326-
apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity(body) => {
328+
apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity_Json(body) => {
327329
let mut response = response.status(422);
328330
{
329331
let mut response_headers = response.headers_mut().unwrap();
330332
response_headers
331333
.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
332334
}
333-
335+
let body_clone = body.clone();
334336
let body_content = tokio::task::spawn_blocking(move || {
335-
serde_json::to_vec(&body).map_err(|e| {
337+
serde_json::to_vec(&body_clone).map_err(|e| {
336338
error!(error = ?e);
337339
StatusCode::INTERNAL_SERVER_ERROR
338340
})

0 commit comments

Comments
 (0)