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

Validate schema before validating data #13

Open
hitode909 opened this issue Jan 2, 2016 · 2 comments
Open

Validate schema before validating data #13

hitode909 opened this issue Jan 2, 2016 · 2 comments

Comments

@hitode909
Copy link
Collaborator

Motivation

We are validating both schema and data in is_valid method.

ok exception { Valiemon->new({ maxItems => 3.14 })->validate([]) };

This is un-useful because:

  • Valid data and invalid schema occurs an exception.
    • Returning valid or invalid, not an exception, is better.
  • Validator have to validate schema every time.
    • Validating schema only once is enough.

Proposal

Validate schema at constructor.

ok exception { Valiemon->new({ maxItems => 3.14 }) };

We can use http://json-schema.org/draft-04/schema ? or implement manually?

@astj
Copy link
Collaborator

astj commented Jan 2, 2016

👍

We can use http://json-schema.org/draft-04/schema ?

Current Valiemon cannot use it 😇

I try to validate it by itself and failed : https://gist.github.com/astj/c9a621574595dae78a14

This package support only single scope and #/ referencing at lib/Valiemon/Attributes/Properties.pm line 29.

@hitode909
Copy link
Collaborator Author

😇

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