Skip to content

Add support for serde rename_all_fields container attribute - #1533

Open
yu256 wants to merge 1 commit into
juhaku:masterfrom
yu256:feat/serde-rename-all-fields
Open

Add support for serde rename_all_fields container attribute#1533
yu256 wants to merge 1 commit into
juhaku:masterfrom
yu256:feat/serde-rename-all-fields

Conversation

@yu256

@yu256 yu256 commented Mar 19, 2026

Copy link
Copy Markdown

Adds support for serde's rename_all_fields container attribute on enums.

#[derive(Serialize, ToSchema)]
#[serde(rename_all_fields = "camelCase")]
enum MyEnum {
    One { some_number: i32 },       // -> someNumber
    Two { another_field: String },   // -> anotherField
    Unit,                            // unaffected
}

Per-variant #[serde(rename_all = "...")] overrides rename_all_fields, following serde's specification.

Closes #853

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the tests nad the code and both LGTM, no comments from my side.

I think the tests cover all aspects (even though those are a bit hard to review given the chore that snapshot tests are 😉)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Support serde rename_all_fields

2 participants