Join GitHub today
Add datetime to formats of JSONSchema #192
Error with this test,
Problem - Datetime validation not being done properly due to lack of formats.
On further digging, I checked that the validate method does have a format_checker in place. Referring to this line in
Conclusion - Adding them, since without them DateTime validation with Spidermon JsonSchema won't work.
changed the title
Proposal to modify testcase of datetime from JSONSchema Tests
Jul 23, 2019
I recommend taking a look here for the same, https://github.com/Julian/jsonschema/blob/e4fa34f6517895a81e5ba7e648dc0796f25f9b21/jsonschema/_format.py#L288
Also, I am not sure how other formats work without their format_checker in place. Maybe their test cases haven't been written or they just somehow work.
@vipulgupta2048 I couldn't get this test failing in a fresh install of spidermon. It is working correctly. These tests weren't updated for a long time and we didn't get errors, so maybe there is something different in your code that is making this error happen.
We also have some (custom format checkers)[https://github.com/scrapinghub/spidermon/blob/master/spidermon/contrib/validation/jsonschema/formats.py] that extends the existing ones from jsonschema. That is the reason that the other formats are working correctly.
I apologize for the false alarm on this one, on a fresh install even I don't see this error popping up. I must have missed something here. Will be more considerate before posting issues next time onwards. Closing!
Regarding custom format checkers, I did check them. I assumed the absence of a DateTime format checker might be the reason for this problem, as also mentioned in the StackOverflow answer.