From: Francis Galiegue <fgalie...@gmail.com>
Date: Tue, 28 Feb 2012 20:15:17 +0100
Local: Tues, Feb 28 2012 2:15 pm
Subject: Re: [json-schema] Re: linking to self as a means of versioning a schema
On Tue, Feb 28, 2012 at 18:31, ps <postsh...@gmail.com> wrote: We are talking JSON here. The $ has no special meaning in any case. If > Xample, thanks for describing these three options. > I think your option #1 ---- re-using the $schema property in the > This provides the full URL to the schema, so someone can discover it > I have three questions: > 1) What does "$" mean in JSON Schemas? My understanding is that you are talking about "$ref", it is a special keyword which points to another JSON document, which should be a schema. Remind that the JSON spec allows _anything_ as a key value in object { } It has nothing to do with JavaScript at all. > 2) My primary schema (called stream-item) relies on a couple other No, $ref serves such a purpose. > schemas, so should I be using the "links" attribute in my schemas? Is > the purpose of "links" to help a JSON schema validator? > 3) I would very much appreciate a critical review of these two No, "$schema" is not an object. It helps telling the validator which > short schemas. Their purpose is in the description fields, and they > are pasted below. > http://trec-kba.org/schemas/v1.0/content-item > http://trec-kba.org/schemas/v1.0/stream-item > Any opinions, changes, feedback, etc would be very welcome! > -John > http://trec-kba.org/schemas/v1.0/content-item version of the JSON Schema draft you use, and its values are URIs. For instance: "$schema": "http://json-schema.org/schema/draft-v3/schema#" [...] > "original_url": { Should be "null" (with quotes), not null, which is the JSON null value > "description": "URL provided by stream_source, only non- > null if differs from abs_url.", > "title": "Original URL", > "type": ["string", null], but does not represent the null type. [...] > "type": ["http://trec-kba.org/schemas/v1.0/news-metadata", This should be: > "http://trec-kba.org/schemas/v1.0/social- > metadata", > "http://trec-kba.org/schemas/v1.0/linking- > metadata"], "type": [ { "$ref": "http://trec-kba.org/schemas/v1.0/news-metadata" }, { "$ref": "http://trec-kba.org/schemas/v1.0/social-metadata" }, { "$ref": "http://trec-kba.org/schemas/v1.0/linking-metadata" } ] [...] "type": [ { "$ref": > "optional": true "optional" does not exist anymore (it did in draft v2) -- in draft v3, it has been replaced with "required" which means the exact opposite. And false is the default for "required", so you can drop this line altogether. > }, You might as well remove this line since by default > }, > "additionalProperties": true "additionalProperties" has an empty schema as a value -- meaning any additional property will have to match the empty schema ({}), which matches all JSON documents. Hope this helps, You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||