Closed tsarquis88 closed 6 months ago
I would expect the following behavior:
date-time
object DOESN'T contain a pattern
field, then it gets validated against the pre-defined regex.date-time
object DOES contain a pattern
field, then it gets validated against the regex within it.It seems the date-time-format-check is not working, that's it. The pattern will be checked additionally if the pattern is present in the schema.
The schema is "and"-combined. If one part of the schema fails, the instance is not valid.
"date": "2022-10-11T00:00:00"
Well, it seems, this is not a valid RFC3339 date, it is missing the UTC-time-offset or the 'Z' character?
The other validators are accepting date-time-format which are not conform with the standard required by the json-schema-standard:
Thanks for the quick answer @pboettch.
Understood, the date should be compliant with both regex.
Well, it seems, this is not a valid RFC3339 date, it is missing the UTC-time-offset or the 'Z' character?
Yes. Everything started with that Z
.
As you're considering this not as a bug, I'll close the issue then.
Description
I have the following JSON schema, that defines a
date-time
object with apattern
:If I use this schema to validate the date:
I got the following error:
But using other validators (like
jsonschemavalidator.net
orpip
'sjsonschema
) the date is validated successfully.Examples
![image](https://github.com/pboettch/json-schema-validator/assets/42682247/0ab43431-b4c7-49e2-9bcd-2ef93d4c90db) ![image](https://github.com/pboettch/json-schema-validator/assets/42682247/6868ad71-0cc6-4c1e-813c-1ae7b7d2bac9)Looking at your source code, it looks like
date-time
formatted object are being validated against a pre-defined regex, ignoring the one set underpattern
. In fact, if I remove the"format": "date-time"
property, the validation looks to be made against the regex underpattern
.Is this the expected behavior? If so, why there is a difference with the other validators?
Thanks in advance.