Skip to content

Commit

Permalink
[Rust-Axum] Use x-response-id if specified (#18906)
Browse files Browse the repository at this point in the history
* [Rust-Axum] Use x-response-id if specified

* update samples
  • Loading branch information
emilycf-cw authored Jun 15, 2024
1 parent 8bac93e commit cc24106
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,18 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
original = operation.getResponses().get(rsp.code);
}

// Create a unique responseID for this response.
String[] words = rsp.message.split("[^A-Za-z ]");

// build responseId from both status code and description
String responseId = "Status" + rsp.code + (
((words.length != 0) && (!words[0].trim().isEmpty())) ?
"_" + camelize(words[0].replace(" ", "_")) : ""
);

rsp.vendorExtensions.put("x-response-id", responseId);
// Create a unique responseID for this response, if one is not already specified with the "x-response-id" extension
if (!rsp.vendorExtensions.containsKey("x-response-id")) {
String[] words = rsp.message.split("[^A-Za-z ]");

// build responseId from both status code and description
String responseId = "Status" + rsp.code + (
((words.length != 0) && (!words[0].trim().isEmpty())) ?
"_" + camelize(words[0].replace(" ", "_")) : ""
);
rsp.vendorExtensions.put("x-response-id", responseId);
}

if (rsp.dataType != null) {
// Get the mimetype which is produced by this response. Note
// that although in general responses produces a set of
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.0-SNAPSHOT
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.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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
- Generator version: 7.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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: 0.1.9
- Generator version: 7.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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: 2.3.4
- Generator version: 7.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0-SNAPSHOT
7.7.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: 0.0.1
- Generator version: 7.6.0-SNAPSHOT
- Generator version: 7.7.0-SNAPSHOT



Expand Down

0 comments on commit cc24106

Please sign in to comment.