0
votes

I'm having problems with Json Schema when I'm trying to validate date-time value between interval of time [2013-11-17T00:00Z, 2015-11-17T00:00Z] I have this Json Schema:

{
  "strictProperties": true ,
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "exampleDate": {
          "format": "date-time",
          "formatMinimum": "2013-11-17T00:00Z",
          "formatMaximum": "2015-11-17T00:00Z"
        }
      }
    }
  },
  "required": [
    "data"
  ]
}

And with this json always out is as valid json:

{
    "data": {
        "exampleDate": "2010-11-17T00:00:00Z"
    }
}

But as you can see, this json is not valid because of the date, it is out of valid range.

I've tested in online tools http://www.jsonschemavalidator.net/, http://jsonschemalint.com/draft4/# and with com.github.fge:json-schema-validator:2.2.6. Could someone help me please? Maybe I missing some configuration besides strictProperties? some step?. Thanks in advance =)

1

1 Answers

2
votes

formatMinimum and formatMaximum are not in JSON Schema v4 draft. They are proposed features for v5:

https://github.com/json-schema/json-schema/wiki/formatMinimum-(v5-proposal)

However, this library can validate formatMinimum and formatMaximum using the v5 option:

https://github.com/epoberezkin/ajv#features