-
Notifications
You must be signed in to change notification settings - Fork 40
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
Cannot validate date-time via the CLI tool #378
Comments
Hi, thanks for the report! This is part of a broader issue which may deserve a rethink. If you are using
and you'll have a fuller suite of formats enabled. I don't really want to change the posture about those package dependencies being optional (because having loosely vetted dependencies increases the chances that we get into dephell issues). However, some formats like I'm pretty sure that |
Thanks for the timely and incredibly useful response! You're right, this worked a treat and gets me the desire behaviour. It'd be great to get some documentation about this on the docs site at https://check-jsonschema.readthedocs.io/en/latest/ if appropriate. Even just signposting to the relevant Should I have a go at this and open a merge request or leave it to yourselves as the existing maintainers? |
I'd be super-happy to look at a docs contribution. Maybe under the FAQ page? I'm not sure where else would be easy to find. I still want to think about building in this behavior or otherwise improving on the status-quo too. |
As of v0.28.0 (just released), I am now including format support for I looked into implementing more formats, and might be open to it in the future, but I'm starting with just these two for now. (Some of the formats require quite a lot of work to parse.) Please let me know if you see any issues with the new behavior, and thanks again for opening this issue! |
If a schema specifies a string in the format of
date-time
, the CLI tool will allow any string value to pass validation. The tool should instead declare the value as not a date-time and the instance should fail the validation.The
date-time
format is defined as a format in JSONSchema 2020-12 Section 7.3.1.Validation occurs correctly for the
date
format but notdate-time
. For example, the following schema and instance files:schema.json
instance.json:
with the following command:
returns the following results:
If I change the value of
thisShouldBeADate
to a valid date, but leave the value ofthisShouldBeADatetime
as a random string, the entire file passes validation.System configuration (if it helps debugging):
EDIT: forgot to mention, https://www.jsonschemavalidator.net/ produces the expected behaviour when given the above schema and instance, hence my raising the issue here.
Thank you for your time and work on this otherwise incredible tool.
The text was updated successfully, but these errors were encountered: