Skip to content

Add field-level rename attribute support #140

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

Merged
merged 1 commit into from
May 29, 2025

Conversation

bkspace
Copy link
Contributor

@bkspace bkspace commented May 29, 2025

Introduces a rename attribute at the field level that takes precedence over the rename_all attribute at the struct level:

CleanShot 2025-05-29 at 08 48 35@2x

Also adds error propagation if you try to use an attribute not specified by shopify_function_rust:

CleanShot 2025-05-29 at 08 49 17@2x

Context:

With serde_json, allow_b2b was deserialised from allowB2b, however with convert_case, the default implementation for camelCase is to deserialise from allowB2B, whereby it treats digits as a boundary. An alternative solution for this specific issue would be to allow for additional configuration to be passed to rename_all. I'd argue that it's more flexible to keep the API simple (as it is currently), but to allow for the field level rename attribute.

Copy link
Contributor

@adampetro adampetro left a comment

Choose a reason for hiding this comment

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

Thank you!

@adampetro adampetro merged commit c6daf51 into Shopify:main May 29, 2025
4 checks passed
@bkspace bkspace deleted the si.field-rename-deser-macro branch June 2, 2025 17:07
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.

2 participants