Support Go Initialisms#573
Support Go Initialisms#573jaredpetersen wants to merge 1 commit intooapi-codegen:masterfrom jaredpetersen:master
Conversation
|
Looks like there's a few failures related to the diff not lining up with what's expected. I'd like to get some initial thoughts on whether this is something that will likely be merged in this release before continuing. The hard part is done. |
|
I'm concerned about this breaking existing code. Can we put this new capital behavior behind a flag? You can default-on your behavior, but allow a way to override. Please see this flag for an example. https://github.com/deepmap/oapi-codegen/blob/master/cmd/oapi-codegen/oapi-codegen.go#L81 |
|
Yeah, that makes sense. It can be done but it will be a bit of a chore to route the configuration to the utility. |
|
There's a global options, no need to route anything: |
|
This regex implementation has a number of issues when you look closer, particularly if you pass in a string that is already camelCase. I'm going to close this out for now. |
|
Thanks for trying.
I originally thought, "oh, generating some code to save work should be easy", and never in a thousand years, did I imagine how complex this would end up being. It's better not to mess with things because the potential for damage is high, while the gain from code that's more idiomatic but no more correct is low.
…________________________________________
From: Jared Petersen ***@***.***>
Sent: Wednesday, May 18, 2022 9:20 AM
To: deepmap/oapi-codegen
Cc: Marcin Romaszewicz; Comment
Subject: Re: [deepmap/oapi-codegen] Support Go Initialisms (PR #573)
This regex implementation has a number of issues when you look closer, particularly if you pass in a string that is already camelCase.
I'm going to close this out for now.
—
Reply to this email directly, view it on GitHub<#573 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALKC5DAGIZWR2EGKILRYFODVKUKFHANCNFSM5V6W7QSA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Fixes #454
I'll leave it up to the library owners to determine whether or not this is breaking behavior. Generated code will have different names:
Before:
After:
Users still have some ability to override this behavior by adding in uppercase characters, e.g
word_word_WORD->WordWordWORD. We can override this behavior now that we have a more intense camelCase function (WordWordWord) but that might be too drastic of a change so I didn't include that.