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

JsonSchema fail / warn on extra keys #1122

Open
LeifW opened this issue Jan 5, 2023 · 1 comment
Open

JsonSchema fail / warn on extra keys #1122

LeifW opened this issue Jan 5, 2023 · 1 comment

Comments

@LeifW
Copy link

LeifW commented Jan 5, 2023

When using a schema generated by genericJsonSchema on a case class, is there a way to have it fail or warn on unrecognized keys? The use case is detecting if the end user typod one of the keys in their json - e.g. if they were supposed to submit {"name": "foo"}, and instead submitted {"nme": "foo"}, it might be nice to tell them "unrecognized key: 'nme'" (as well as "missing key": 'name'"), instead of just "missing key": 'name'".
Or perhaps a way to get access to the list of fields on that case class from the JsonSchema, so we could do that check ourselves?

@julienrf
Copy link
Member

julienrf commented Jan 6, 2023

This need is not addressed by endpoints4s currently. It could be implemented in endpoints4s or outside of endpoints4s.

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

No branches or pull requests

2 participants