Enums are not case insensitive
See original GitHub issueFirst off: great job, guys!
Small issue: it looks like even though the wiki states that option properties bound to enum values are case insensitive:
When specifying enum values, you don’t need to respect case. Both app -g bye and app --greet-type REGARDS are allowed.
unfortunately, they are not. I have a program that for a line like this:
settings -s gogo -v 23 -t int
where -t is bound to an enum SettingType {Int, String, ...}
, I get an error:
ERROR(S):
Option 't, type' is defined with a bad format.
-s, --setting The name of a setting to be added or modified.
-v, --value The new value of the setting. The option is required if -s or --setting is specified.
-t, --type (Default: String) The case-sensitive type of the value of the setting. The option is not mandatory and if not specified, the
type will be either implied from the existing setting with the same name or it will be assumed to be 'String'. The most common
types are: String, Int, Guid, Decimal, Boolean, DateTime, Date, Time, Uri, TimeSpan. DateTime values are assumed to be UTC.
[...etc]
BadFormatConversionError
StopsProcessing = False
Tag = ErrorType.BadFormatConversionError
NameInfo = NameInfo
LongName = type
NameText = t, type
ShortName = t
But if I enter the command like this:
settings -s gogo -v 23 -t Int
all is good.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Case-insensitive matching of a string to a Java enum
valueOf("Monday");. If the string passed to valueOf() does not match (case sensitive) an existing Day value, an IllegalArgumentException ...
Read more >Case Insensitive Enum Mapping in Spring Boot
In this tutorial, we'll shed light on how to handle enum mapping in a case-insensitive manner when passing it as request parameter in...
Read more >How to decode enums ignoring case in Swift Codable
The default behavior for enums decoding is case-sensitive comparison, meaning "MEMBER" and "Member" will fail our decoding. You will get a fatal ...
Read more >Spring Boot: How to ignore case when using an Enum as a ...
Here is a way to enable the use of case-insensitive enumerations request parameters. You won't need to do any code modification in your...
Read more >proposal: case-insensitive enum
In my opinion, the simplest solution is just to add a "caseInsensitive" flag or something similar to the standard. There are other use...
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
It would be nice if you merge this PR after so many months.
Also experiencing the same issue using the latest v2.2.0 package. Setting CaseInsensitiveEnumValues = true has no effect.