Can't understand ENUM_NAME_OVERRIDES documentation
See original GitHub issueAfter reading the docs on ENUM_NAME_OVERRIDES:
- https://drf-spectacular.readthedocs.io/en/latest/faq.html#i-get-warnings-regarding-my-enum-or-my-enum-names-have-a-weird-suffix
- https://drf-spectacular.readthedocs.io/en/latest/settings.html?highlight=ENUM_NAME_OVERRIDES#settings
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:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@johnthagen from a logical point of view you are absolutely right. I made this choice for 2 reasons.
listwould fail. its easy to convert but I tried to make it easy on the users.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.
@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.