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

String format validation is not supported #15

Open
thatside-zaraffa opened this issue Jan 4, 2018 · 5 comments
Open

String format validation is not supported #15

thatside-zaraffa opened this issue Jan 4, 2018 · 5 comments

Comments

@thatside-zaraffa
Copy link

Validation like:

"email": {
    "type": "string",
    "format": "email"
},

won't work as expected. See http://json-schema.org/latest/json-schema-validation.html#rfc.section.7 for list of currently supported formats and http://json-schema.org/draft-07/json-schema-release-notes.html#formats for those which were added in draft 7.

@mokkabonna
Copy link
Owner

That's correct, it is listed as an TODO in the roadmap in the readme.

It is optional. However I plan to support it. PR's are welcome though.

Implementations MAY support the "format" keyword as a validation assertion. Should they choose to do so:

they SHOULD implement validation for attributes defined below;
they SHOULD offer an option to disable validation for this keyword.
Implementations MAY add custom format attributes. Save for agreement between parties, schema authors SHALL NOT expect a peer implementation to support this keyword and/or custom format attributes.

@thatside-zaraffa
Copy link
Author

I will try to add this if I'll have enough time.
An idea to consider: maybe this library could use AJV under the hood? This is a great change but the main win from this decision would be the speed of implementation of new JSON Schema drafts because AJV author participates a lot in JSON Schema development process.

And a little off-topic issue: it seems that schemaRequired => noParamsRequired validator doesn't work like in Vuelidate (code here: https://github.com/monterail/vuelidate/blob/master/src/validators/common.js#L5).

@mokkabonna
Copy link
Owner

  1. Have considered it, don't remember exactly the thought process, but for now I keep it as is. As you said it is also a big change. I will probably reevaluate in the future.
  2. This intentional. I follow json schema definition of required, not vuelidate. See https://github.com/mokkabonna/vue-vuelidate-jsonschema#required-property-in-json-schema-context

@moltar
Copy link

moltar commented Mar 18, 2018

+1 for ajv - it's the fastest JSON schema validator out there. Why not take advantage of that?

@moltar
Copy link

moltar commented Mar 19, 2018

Another thing not supported is $data refs. Very useful for password confirmations to compare two passwords.

ajv supports this natively.

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