-
Notifications
You must be signed in to change notification settings - Fork 76
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
Handle enum values that contain meaningful non-alphanumeric characters #397
Comments
This is great. Thanks for filing this. Abstractly what I've been thinking about for this type of situation (and it relates to oxidecomputer/typify#1) is some sort of collective naming ... thingy... into which we put the raw materials and then it outputs a unique collection. The idea is that the collection would retain a bunch of details and then look at the full set to determine what elements were required for uniqueness. In this case, we'd want the output to be the set of This is also true of type for which we have no great name and instead use the "path" i.e. if there's a type FooType with a field bar, we might have a type called FooTypeBar. |
Got it, that make sense, I should have checked through the typify issues first. Solving that generally, for local scopes like variants, and a global scope for component structs would be very useful. |
I think what you suggesting is a subtle and great idea: we can prototype the larger naming concept first in local contexts such as variant names. |
Hi @ahl, I also encountered this issue when trying to get Avoma's spec to work. I agree with the idea you outlined in typify #695, I'd happily put in some extra work to get a better output. In the meantime, is there a way to hack together a workaround you would suggest? |
As I noted here, I've evolved my thinking a bit here. Using this I'm going to be thinking about what this might look like, but would welcome proposals. It'a always helpful to have concrete examples such as this one. |
The GitHub API spec contains the following enum for sorting (truncated for clarity):
The enum generated for this results in duplicate variant names:
I think this is fixable by updating the
sanitize
utility intypify
to remove the-1
and+1
branches, and performing that conversion as a.replace("-1", "minus1")
, etc in the catch all branch instead.The text was updated successfully, but these errors were encountered: