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
Error: unknown format "date-time" ignored in schema at path "#/properties/timestamp" #1295
Comments
Are you sure you are using version 6 and not 7? Try validating just date time string against schema {format: “date-time”}. A side comment - you don’t need to validate the schema in a separate call to validateSchema, it happens by default. |
This is a working example: https://runkit.com/esp/5f6224b4256fbf001beeee11 Please try to reproduce your issue in runkit (you can clone this sample), but please keep the total code size under 20 lines - I cannot review or debug your application schema. |
I get this error on 7.0.0-beta.3: |
No, the formats are now in ajv-formats package - see its docs how to add them. |
I'm using the version 6.12.6 and seems to works fine, I'm trying to do exactly the same as you |
I am not sure what the issue is. If the issue is with Ajv v6.* please submit the full code sample to reproduce, what’s above is not enough to understand the problem. If it’s with Ajv v7.* it is because formats are now in a separate package ajv-formats that has to be added if you use them - seem release notes for v7. |
I can confirm running into this error when migrating from v6 to v7 and it was solved by following the instructions here: https://ajv.js.org/docs/validation.html#formats |
Thanks for the awesome library. For those who are using NodeJs require, the below snippet works const AJV = require('ajv').default;
const addFormats = require('ajv-formats').default;
const ajv = new AJV();
addFormats(ajv); |
closing here - thank you for the examples |
@epoberezkin is there a way to use string formats with |
What version of Ajv are you using? Does the issue happen if you use the latest version?
6.12.5
JSON Schema
Sample data
Your code
Validation result, data AFTER validation, error messages
What results did you expect?
I am having this trouble also for 'URI'. My question is why is AJV ignoring all the formats? i am using
The text was updated successfully, but these errors were encountered: