Can't understand ENUM_NAME_OVERRIDES documentation

See original GitHub issue

After reading the docs on ENUM_NAME_OVERRIDES:

and the error messages:

  • “enum naming encountered a non-optimally resolvable collision for fields named “status”. The same name has been used for multiple choice sets in multiple components. The collision was resolved with “Status578Enum”. add an entry to ENUM_NAME_OVERRIDES to fix the naming.”
  • " encountered multiple names for the same choice set (ResponseStatusEnum). This may be unwanted even though the generated schema is technically correct. Add an entry to ENUM_NAME_OVERRIDES to fix the naming."

…I still don’t know what it is talking about. What are the keys of the dictionary, and what are the values? What entry do I add, and how does that help?

Sorry for being dense, but if this is unclear to me probably someone else is struggling too. Thanks in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tfranzelcommented, Oct 13, 2021

@johnthagen from a logical point of view you are absolutely right. I made this choice for 2 reasons.

  1. keys must be hashable, so a list would fail. its easy to convert but I tried to make it easy on the users.
  2. enforce the enum names are unique.

argument 2 is a bit weak as the same choice set can be used for multiple names (keys), but we do catch that and emit a warning. I think you can make a valid case for both directions, but in principle it should be a 1:1 mapping anyway.

1reaction
spookylukeycommented, Aug 25, 2021

@tfranzel Thanks so much that really helps. If you don’t mind I’ll try to come up with a patch for the docs using this explanation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I guarantee that my enums definition doesn't change ...
So supposing you only know the name for your new enum value, you can still add it without problems: // Add 'Extra Large'...
Read more >
Enum: How to use name() and toString() methods correctly
The name() method is final, so cannot be overwritten while conversely, the toString() method is open and can be overwritten. In fact, ...
Read more >
Enum implementation overrides custom toString #7227 - GitHub
When overriding toString in an enum, simple cases end up using their name instead of this new implementation. minimized code. enum E: case ......
Read more >
Enumeration types - C# reference - Microsoft Learn
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type....
Read more >
Handbook - Enums - TypeScript
In this generated code, an enum is compiled into an object that stores both forward ( name -> value ) and reverse (...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found