[rust-axum] fix: support range response status codes (4XX, 5XX)

Merged
WI
1d ago
+2410-1

based on https://github.com/OpenAPITools/openapi-generator/pull/25294 with resolved merge conflicts

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes the rust-axum generator so range status codes like 4XX and 5XX are 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 a status: u16 field, and the generated server applies it with StatusCode::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.