-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(Rust): Use rename_all #2214
Conversation
I don't understand the test error. Can someone help me with this ? |
Ok, I understood the problem. The Does someone know why the field name is not kept ? |
Add a camelCase unit test
I've fixed the problem with the unit tests. I also add one with camel case properties to test the new feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Just a few small stylistic changes requested.
"UPPERCASE": { | ||
regex: /^[A-Z][A-Z0-9]*$/, | ||
toParts: (name: string): string[] => [name], | ||
fromParts: (parts: string[]): string => parts.map(p => p.toUpperCase()).join(''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to write the types for each toParts and fromParts wince you declared them for the entire struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I use them to detect the input fields formats.
I also use them to detect if a field does not match the global type.
I’ve just fixed the tests, please merge master. |
Detects the the most used naming style in the class properties and enum cases to define it in the rename_all when needed.
Replaces #2210
Closes #528