Skip to content
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

Specify case sensitivity of enum values #184

Closed
sfackler opened this issue Dec 11, 2018 · 3 comments
Closed

Specify case sensitivity of enum values #184

sfackler opened this issue Dec 11, 2018 · 3 comments

Comments

@sfackler
Copy link
Member

sfackler commented Dec 11, 2018

conjure-java currently normalizes enum values to uppercase when deserializing, so the JSON value "one", "One", "ONE", etc will all successfully deserialize to an EnumExample.ONE (and unknown variants will be upper-cased).

This behavior isn't actually specified, however.

@ferozco
Copy link
Contributor

ferozco commented Dec 11, 2018

The wire spec states that string comparison should be used when comparing enums and the language spec state that all enum values must be UPPERCASE. It follows that "ONE" is valid but "One", "one" are invalid. The documentation could probably be a little more explicit about the handling of such cases.

It does seem like you've found conjure-java being overly permissive. We should follow up with test cases in conjure-validation and then fix things up in conjure-java

@sfackler
Copy link
Member Author

Cool - should we close this and open issues on conjure-java/conjure-validation?

@ferozco
Copy link
Contributor

ferozco commented Dec 11, 2018

ya if you could that would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants