networknt / json-schema-validator

A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12
Apache License 2.0
822 stars 323 forks source link

Since 1.3.0: date not correctly validated #938

Closed itineric closed 6 months ago

itineric commented 7 months ago

Consider the following schema:

{
  "type": "object",
  "properties":
  {
    "creation_date":
    {
      "type": "string",
      "format": "date-time"
    }
  }
}

The following JSON should not be valid but it is:

{
  "creation_date": "not a date"
}

This was working with version 1.2.0

justin-tay commented 7 months ago

In version 1.3.0 the format keyword by default complies with the specification that it should be an annotation since 2019-09 and configuration needs to be set to always generate an assertion or the required vocabulary needs to be in the meta schema.

https://json-schema.org/draft/2020-12/json-schema-validation#name-vocabularies-for-semantic-c

rmuller commented 6 months ago

Should not this be closed? Because as of 1.3.2 this works as expected (= according to the spec and documentation of this library)

stevehu commented 6 months ago

@rmuller Thanks a lot for your confirmation.