1

We have a JSON schema with format property, snippet below:

"properties": {
        "expireDateTime": {
        "description": "Date when the time will expire.  If granularity is at the date level then YYYY-MM-DD is passed.  If the granularity is at the hour/minute level then the date time format is YYYY-MM-DDThh:mm:ss+-hh:mm",
        "type": "string",
        "format": [ "date-time", "date" ]
        } }

We are processing it using the Json.Net parser from NewtonSoft. This used to parse correctly with the previous version of the framework (v6.x), which only supported draft 3. With the latest version of the framework that supports draft 4, I get an error that format cannot be an array.

I looked around and did not see anything in the draft 3 spec that says that format can or cannot be an array. https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-5.23

However, draft 4 clearly states that format must be a string. http://json-schema.org/latest/json-schema-validation.html#anchor79

Am I correct in assuming that the Json.Net framework is not backward compatible in this aspect? Or was the way it worked in the previous versions erroneous? It will help us handle the problem accordingly. Thanks.

1
  • do you have a missing closing curly brace? Commented Feb 18, 2015 at 0:00

1 Answer 1

1

In draft 3 the format property was intended as a string, not an array of strings.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks James. So I suppose this was an oversight in the previous version of Json.Net.
I'm not sure what you are referring to. Json.NET has always only supported "format" as a string.
The JSON snippet I have provided used to work though. I'm not sure why or how.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.