Subject: [apps-discuss] Feedback on draft-zyp-json-schema-03

From: "Thomson, Martin" <[email-masked]>
Date: Fri, 29 Jul 2011 04:44:00 +0800

Wow.

There is way too much stuff in this document.  It includes far more than I expected to find.  Some of that is pretty cool and I'd encourage you to find a way to submit a draft on each of:

 - the link relation type (this shouldn't just be constrained to JSON schemas)

 - the grammar for identifying parts of a JSON document

For that reason, I did not review Sections 4 and 6.

You'll notice that I don't have a lot of criticisms on the core schema stuff.  Despite these criticisms, the core of the specification is looking pretty strong.

Criticisms:

The simple type constraints (or facets) in XML schema are quite good, widely understood and fairly simple.  I'd encourage you to borrow these wholesale - semantics, names and all.

Complex types cannot be defined outside of the context where they are used.  For more complicated schema documents, the ability to define a set of properties, assign them an identity and include this set by reference would be a powerful tool.

The extension mechanism is a tough one to get right.  Such things are a royal pain in XML schemas and only marginally better in RelaxNG.  By addressing the above, this feature might not be necessary.

I really don't like the way that arrays can have different types at each position in the array.  I appreciate that JSON can do this, but there is no need to condone that sort of behaviour.

I really like the idea that the default mode is for objects to be extensible by default.  The idea that you might identify a specific schema (in additionalProperties/additionalItems) that is valid for extension, I like a whole lot less.  And why is it just one schema?  I don't see a strong case for this sort of feature.

I didn't get dependencies, but I didn't try that hard.  The description was confusing and it smells pretty bad.

Section 7 made little sense to me.

Questions:

Can default have an object value?  I assume yes.

Does the default have to be valid according to the grammar?

Why do $ref and $schema have the '$'?  Since you've no risk of collision, why not just drop it?

--Martin