Repository navigation
[rust-axum] fix: support range response status codes (4XX, 5XX) - #25555
Merged
Merged
Conversation
…ovillanueva/openapi-generator into teovillanueva-fix/rust-axum-range-responses
3 tasks done
wing328
marked this pull request as ready for review
November 4, 2026 08:50
Contributor
There was a problem hiding this comment.
2 issues found across 18 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="samples/server/petstore/rust-axum/output/rust-axum-range-responses/README.md">
<violation number="1" location="samples/server/petstore/rust-axum/output/rust-axum-range-responses/README.md:33">
P2: The README documents a nonexistent `conversions` feature. Rename it to `conversion` so users can enable the feature declared by this crate.</violation>
<violation number="2" location="samples/server/petstore/rust-axum/output/rust-axum-range-responses/README.md:47">
P2: The example implements the nonexistent `apis::default::Api` trait. Use `apis::default::Default` to match the trait this generated crate exposes.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
View guided diff | Turn on auto-fix | Re-trigger cubic
| * This defaults to enabled and creates the basic skeleton of a server implementation based on Axum. | ||
| * To create the server stack you'll need to provide an implementation of the API trait to provide the server function. | ||
| * Disabling it (`default-features = false`) leaves only `models` and `types`, without Axum, Tokio or other server dependencies (including `ammonia`, so the XSS check in model validation is skipped), e.g. for sharing the models with a WASM frontend. | ||
| * `conversions` |
Contributor
There was a problem hiding this comment.
P2: The README documents a nonexistent conversions feature. Rename it to conversion so users can enable the feature declared by this crate.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/server/petstore/rust-axum/output/rust-axum-range-responses/README.md, line 33:
<comment>The README documents a nonexistent `conversions` feature. Rename it to `conversion` so users can enable the feature declared by this crate.</comment>
<file context>
@@ -0,0 +1,94 @@
+ * This defaults to enabled and creates the basic skeleton of a server implementation based on Axum.
+ * To create the server stack you'll need to provide an implementation of the API trait to provide the server function.
+ * Disabling it (`default-features = false`) leaves only `models` and `types`, without Axum, Tokio or other server dependencies (including `ammonia`, so the XSS check in model validation is skipped), e.g. for sharing the models with a WASM frontend.
+* `conversions`
+ * This defaults to disabled and creates extra derives on models to allow "transmogrification" between objects of structurally similar types.
+
</file context>
Suggested change
| * `conversions` | |
| * `conversion` |
|
|
||
| #[allow(unused_variables)] | ||
| #[async_trait] | ||
| impl rust_axum_range_responses_test::apis::default::Api for ServerImpl { |
Contributor
There was a problem hiding this comment.
P2: The example implements the nonexistent apis::default::Api trait. Use apis::default::Default to match the trait this generated crate exposes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/server/petstore/rust-axum/output/rust-axum-range-responses/README.md, line 47:
<comment>The example implements the nonexistent `apis::default::Api` trait. Use `apis::default::Default` to match the trait this generated crate exposes.</comment>
<file context>
@@ -0,0 +1,94 @@
+
+#[allow(unused_variables)]
+#[async_trait]
+impl rust_axum_range_responses_test::apis::default::Api for ServerImpl {
+ // API implementation goes here
+}
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
based on #25294 with resolved merge conflicts
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Fixes the
rust-axumgenerator so range status codes like4XXand5XXare sent as the concrete status chosen by the implementation instead of being dropped or replaced at the call site.Previously the selectable status ended up emitting a fixed code and relied on
body.code.parse(). Now each range response variant carries astatus: u16field, and the generated server applies it withStatusCode::from_u16, returning a 500 when the value is invalid. The change covers empty, JSON, and SSE responses, and applies all headers attached to the range response.Written for commit 26c2a8e. Summary will update on new commits.