schema for json schema

10 views
Skip to first unread message

Cory Bennett

unread,
Nov 2, 2009, 10:19:08 PM11/2/09
to JSON Schema
Perhaps I am misreading it, but the self-descriptive schema at
http://json-schema.org/schema seems to have a few issues with it.

Some issues (using the JSONPath notation):

* $.properties.specificity is not in the latest draft spec.

* $.properties.type.items.$ref => $.properties.type
This is a bit strange. Since $.properties.type.type = ["string",
"array"] that implies any recursive
combination of strings and arrays is valid, as in something like
this:
{"type": [ [ "integer" ], [ [ [ "number",
[ [ "boolean" ] ] ] ] ] ] }
I assume that is not meant to be a valid schema?

* $.properties.type uses options, not enum?
Not sure if it was intentional, but it seems that there should be
an enum property like:
"enum":
["string","object","array","boolean","number","integer","null","any"]
The spec says: 'The "options" attribute does not affect validation'
and it seems like it would be a good
idea to be able to validate the type in a schema.

* $.properties.items.type = "object"
I think this should be set to ["object", "array"] since items can be
used to "tuple type" according to
the draft spec.

* $.properties.items.properties.$ref => $.properties
It does not seem valid to say anything in $.properties is a valid
property of the "items" property. This
would allow for some schemas that are odd looking if not invalid:
{ "type": "array", "items": { "default": 42 } }
That is odd since "default" is not a valid property for items (from
what I can infer from the spec) and
will be ignored, or if the "default" property was not ignored it
could lead to an infinite array of 42's
(depending on validation engine implementation) since
additionalProperties is default "true".

I am sure there are a few others, but I wills stop here for now :)

Anyway, I just wanted to get some feedback to see if I am missing
something.

Thanks
-Cory

Kris Zyp

unread,
Nov 4, 2009, 10:57:56 AM11/4/09
to json-...@googlegroups.com
Yes, I believe you are right, I am going to be working on finishing up a
IETF/RFC-style spec for JSON schema, and will try to clean up the
self-descriptive schema then. Thank you for the highlighting the issues.
Kris
Reply all
Reply to author
Forward
0 new messages