-
Notifications
You must be signed in to change notification settings - Fork 412
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
[gen] support for normalized fields #3031
Labels
Comments
/bounty $75 |
💎 $75 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
/attempt #3031
|
💡 @hochgi submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
hochgi
added a commit
to hochgi/zio-http
that referenced
this issue
Sep 3, 2024
…n for zio#3031 (which will add more annotations). Specifically: use imports insteads of inlined FQCN when adding annotations
🎉🎈 @hochgi has been awarded $75! 🎈🎊 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
APIs are messy, fields come in all flavors: snake_case, kebab-case, or even whitespaced tokens.
While illegal scala variable names are backtick escaped since #2839, we still end up with unconventional (ugly) generated code.
Even legal names, like snake_case, or UPPER_SNAKE which are not escaped does not look "pretty" in generated code.
Describe the solution you'd like
Add a flag in configuration, to allow change the field name, and add an annotation like:
There would have to be some parser with heuristics involved. Which tokens casing to preserve, capitalize, lowercase, etc'…
Describe alternatives you've considered
putting up with ugly generated code? 😅
Additional context
There is no "right" answer on how to parse & transform field names.
e.g: perhaps
arn_API-Gateway
should preserve some casing and be converted toarnAPIGateway
?Or perhaps we prefer to always use capitalized tokens, and even break
arn_APIGatway
toarnApiGateway
?Anything would be better than backtick escaped
Moreover, maybe the configuration can also allow customization for some "unparseable" replacements (like when starting with a non-letter char), e.g:
This might be only "cosmetics", but it can really improve generated code quality.
The text was updated successfully, but these errors were encountered: