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

Add way of rejecting input with extra keys #165

Open
wsong opened this issue Sep 22, 2015 · 2 comments
Open

Add way of rejecting input with extra keys #165

wsong opened this issue Sep 22, 2015 · 2 comments

Comments

@wsong
Copy link

wsong commented Sep 22, 2015

If I have a case class like:

case class FoobarClass(optional_value: Option[String] = None)

And I receive input like:

"{"optional_valeu": "test"}" (note that "optional_value" is misspelled)

It'd be nice to be able to throw an exception immediately instead of silently using the default value for optional_value. Is there a way to do this without defining my own RootJsonFormat?

@sirthias
Copy link
Member

sirthias commented Nov 2, 2015

Currently there is no way to do this but I agree that such a setting would be a valuable thing to have.
Thanks for the ticket!

@SepidehAlassi
Copy link

@wsong and @sirthias I need the same feature: throw an exception if a field name was not known instead of silently ignoring the object and using the default value of the optional key. Is there any plan to merge [PR #166]?

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

3 participants