Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] rust-axum response naming scheme is bad #20411

Open
musjj opened this issue Jan 7, 2025 · 0 comments
Open

[REQ] rust-axum response naming scheme is bad #20411

musjj opened this issue Jan 7, 2025 · 0 comments

Comments

@musjj
Copy link

musjj commented Jan 7, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant