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 method to sanitize input #22

Open
bachp opened this issue Jan 18, 2014 · 1 comment
Open

Add method to sanitize input #22

bachp opened this issue Jan 18, 2014 · 1 comment

Comments

@bachp
Copy link

bachp commented Jan 18, 2014

The sanitize method should take a schema and an input json. It should then output a version of the input that corresponds to the schema or throw an error if not possible.

For example it should:

  1. Remove fields that are present but not defined in the schema
  2. Keep fields that are correct according to the schema
  3. Remove fields that don't match the schema but are optional
  4. Throw an error if a required field is missing

Optionally it would also be good to have a strict mode so that in case 2) an error would be thrown as well.

@orospakr
Copy link

orospakr commented Aug 2, 2014

+1, this would be perfect for what I'd like to do!

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