Non unique enum names with `-` and `+` prefixes
See original GitHub issueWhat are the steps to reproduce this issue?
- Add an enumeration with two values that vary only with the
-
and+
prefixes:
- in: query
name: sort
required: false
description: >
The property to sort on. Direction is ascending by default. To
indicate descending, prefix property with `-`
schema:
type: string
enum:
- date
- -date
What happens?
Those special characters are ignored and the keys are identical:
export const MyOperationSort = {
date: '-date' as MyOperationSort,
date: 'date' as MyOperationSort,
};
What were you expecting to happen?
The special characters are escaped so that we can use the enumeration.
Any other comments?
This issue has been discovered while using the -
and +
convention to define the direction on a sorting parameter. It has been reported on the guideline owner too: https://github.com/belgif/rest-guide/issues/98
Issue Analytics
- State:
- Created a year ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
CA1712: Do not prefix enum values with type name
Names of enumeration members are not prefixed with the type name because type information is expected to be provided by development tools.
Read more >Duplicate ENUM names not handled correctly #197 - GitHub
If I understand correctly, you have raised the two issues here: 1: What if enum column name is same and different enum definitions...
Read more >How to refer to different enum values which share a duplicate ...
The general way around this is to use prefixes which appear in most libraries like ... Then you can use the same names...
Read more >10.2 — Unscoped enumerations - Learn C++
Unscoped enumerations are defined via the enum keyword. ... which are considered non-distinct from the types they are aliasing).
Read more >Enum Type - Free Pascal wiki
An enumeration is defined by surrounding a non-empty comma-separated ... thus requiring users to always specify the type name as a prefix:.
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 FreeTop 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
Top GitHub Comments
Hello @NimmLor, just added x-enumNames with the
orval@6.11.0-alpha.4
For the next release, I would like to give a flag to remove the parsing completely and also the possibility to parse it how you want