OpenAPITools / OpenAPITools/openapi-generator

[REQ] `rust-axum` response naming scheme is bad

Open
#20,411 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Generated response naming schemes for rust-axum is really bad:

pub enum DeleteOrderResponse {
    /// Invalid ID supplied
    Status400_InvalidIDSupplied,
    /// Order not found
    Status404_OrderNotFound,
}

This breaks Rust's naming conventions (PascalCase) and will trigger an endless amount of Clippy warnings (that I don't want to just ignore).

Describe the solution you'd like

I think a better naming scheme would be:

pub enum DeleteOrderResponse {
    /// Invalid ID supplied
    Status400InvalidIDSupplied,
    /// Order not found
    Status404OrderNotFound,
}

Or more true to Rust's conventions:

pub enum DeleteOrderResponse {
    /// Invalid ID supplied
    InvalidIDSupplied,
    /// Order not found
    OrderNotFound,
}

This can potentially generate duplicate names, but the compiler can catch the error just fine so it's not a real issue.

Describe alternatives you've considered

I tried to change the naming scheme in the configuration, but couldn't figure out how.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the rust-axum generator code responsible for naming generated response enum variants, then inspect any related tests or snapshots. Compare the current underscore-separated names with the two proposed Rust-style alternatives and determine which behavior the project should standardize. Done means generated responses use the selected naming scheme without Clippy naming warnings, with tests covering the example cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.