Permalink
Browse files

Schema URIs are now namespace versioned.

Added simple string format for the "dependencies" attribute.
Added "$ref" and "$schema" attribute definitions.
  • Loading branch information...
1 parent f2f4141 commit 8c1e8af3bbfe054271c8563009a7d19b5ab04455 @garycourt garycourt committed Nov 12, 2010
View
12 address
@@ -1,12 +0,0 @@
-{"description":"An Address following the convention of http://microformats.org/wiki/hcard",
- "type":"object",
- "properties":{
- "post-office-box":{"type":"string","requires":"street-address"},
- "extended-address":{"type":"string","requires":"street-address"},
- "street-address":{"type":"string","requires":"region"},
- "locality":{"type":"string","requires":"region", "required":true},
- "region":{"type":"string","requires":"country-name", "required":true},
- "postal-code":{"type":"string"},
- "country-name":{"type":"string", "required":true}
- }
-}
View
20 calendar
@@ -1,20 +0,0 @@
-{"description":"A representation of an event",
- "type":"object",
- "properties":{
- "dtstart":{"format":"date-time","type":"string","description":"Event starting time","required":true},
- "summary":{"type":"string","required":true},
- "location":{"type":"string"},
- "url":{"type":"string","format":"url"},
- "dtend":{"format":"date-time","type":"string","description":"Event ending time"},
- "duration":{"format":"date","type":"string","description":"Event duration"},
- "rdate":{"format":"date-time","type":"string","description":"Recurrence date"},
- "rrule":{"type":"string","description":"Recurrence rule"},
- "category":{"type":"string"},
- "description":{"type":"string"},
- "geo":"http://json-schema.org/geo"
- }
-}
-
-
-
-
View
43 card
@@ -1,43 +0,0 @@
-{"description":"A representation of a person, company, organization, or place",
- "type":"object",
- "properties":{
- "fn":{"description":"Formatted Name","type":"string"},
- "familyName":{"type":"string", "required":true},
- "givenName":{"type":"string", "required":true},
- "additionalName":{"type":"array","items":{"type":"string"}},
- "honorificPrefix":{"type":"array","items":{"type":"string"}},
- "honorificSuffix":{"type":"array","items":{"type":"string"}},
- "nickname":{"type":"string"},
- "url":{"type":"string","format":"url"},
- "email":{
- "type":"object",
- "properties":{
- "type":{"type":"string"},
- "value":{"type":"string","format":"email"}},
- },
- "tel":{
- "type":"object",
- "properties":{
- "type":{"type":"string"},
- "value":{"type":"string","format":"phone"}},
- },
- "adr":"http://json-schema.org/address",
- "geo":"http://json-schema.org/geo",
- "tz":{"type":"string"},
- "photo":{"format":"image","type":"string"},
- "logo":{"format":"image","type":"string"},
- "sound":{"format":"attachment","type":"string"},
- "bday":{"type":"string","format":"date"},
- "title":{"type":"string"},
- "role":{"type":"string"},
- "org":{"type":"object",
- "properties":{
- "organizationName":{"type":"string"},
- "organizationUnit":{"type":"string"}},
- }
- }
-}
-
-
-
-
View
68 draft-00/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-00/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "dot-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-00/schema#"}
+}
View
8 json-ref → draft-00/json-ref
@@ -1,9 +1,9 @@
{
- "$schema" : "http://json-schema.org/hyper-schema",
- "id" : "http://json-schema.org/json-ref",
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/json-ref#",
- "items" : "#",
- "additionalProperties" : "#",
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
"links" : [
{
View
33 draft-00/links
@@ -0,0 +1,33 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-00/hyper-schema#"},
+ "optional" : true
+ }
+ }
+}
View
155 draft-00/schema
@@ -0,0 +1,155 @@
+{
+ "$schema" : "http://json-schema.org/draft-00/hyper-schema#",
+ "id" : "http://json-schema.org/draft-00/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "maxDecimal" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+}
View
68 draft-01/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-01/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "dot-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-01/schema#"}
+}
View
26 draft-01/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/json-ref#",
+
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+}
View
33 draft-01/links
@@ -0,0 +1,33 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-01/hyper-schema#"},
+ "optional" : true
+ }
+ }
+}
View
155 draft-01/schema
@@ -0,0 +1,155 @@
+{
+ "$schema" : "http://json-schema.org/draft-01/hyper-schema#",
+ "id" : "http://json-schema.org/draft-01/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "maxDecimal" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+}
View
68 draft-02/hyper-schema
@@ -0,0 +1,68 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-02/links#"},
+ "optional" : true
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "optional" : true,
+ "default" : "slash-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "media-type"
+ },
+
+ "alternate" : {
+ "type" : "array",
+ "items" : {"$ref" : "#"},
+ "optional" : true
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "slash-delimited",
+ "extends" : {"$ref" : "http://json-schema.org/draft-02/schema#"}
+}
View
26 draft-02/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/json-ref#",
+
+ "items" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ },
+
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+}
View
35 draft-02/links
@@ -0,0 +1,35 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string"
+ },
+
+ "rel" : {
+ "type" : "string"
+ },
+
+ "targetSchema" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET",
+ "optional" : true
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method",
+ "optional" : true
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-02/hyper-schema#"},
+ "optional" : true
+ }
+ }
+}
View
166 draft-02/schema
@@ -0,0 +1,166 @@
+{
+ "$schema" : "http://json-schema.org/draft-02/hyper-schema#",
+ "id" : "http://json-schema.org/draft-02/schema#",
+ "type" : "object",
+
+ "properties" : {
+ "type" : {
+ "type" : ["string", "array"],
+ "items" : {
+ "type" : ["string", {"$ref" : "#"}]
+ },
+ "optional" : true,
+ "uniqueItems" : true,
+ "default" : "any"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ },
+
+ "optional" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "additionalProperties" : {
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "optional" : true,
+ "default" : {}
+ },
+
+ "requires" : {
+ "type" : ["string", {"$ref" : "#"}],
+ "optional" : true
+ },
+
+ "minimum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "maximum" : {
+ "type" : "number",
+ "optional" : true
+ },
+
+ "minimumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "minimum",
+ "default" : true
+ },
+
+ "maximumCanEqual" : {
+ "type" : "boolean",
+ "optional" : true,
+ "requires" : "maximum",
+ "default" : true
+ },
+
+ "minItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxItems" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0
+ },
+
+ "uniqueItems" : {
+ "type" : "boolean",
+ "optional" : true,
+ "default" : false
+ },
+
+ "pattern" : {
+ "type" : "string",
+ "optional" : true,
+ "format" : "regex"
+ },
+
+ "minLength" : {
+ "type" : "integer",
+ "optional" : true,
+ "minimum" : 0,
+ "default" : 0
+ },
+
+ "maxLength" : {
+ "type" : "integer",
+ "optional" : true
+ },
+
+ "enum" : {
+ "type" : "array",
+ "optional" : true,
+ "minItems" : 1,
+ "uniqueItems" : true
+ },
+
+ "title" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "description" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "format" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "contentEncoding" : {
+ "type" : "string",
+ "optional" : true
+ },
+
+ "default" : {
+ "type" : "any",
+ "optional" : true
+ },
+
+ "divisibleBy" : {
+ "type" : "number",
+ "minimum" : 0,
+ "minimumCanEqual" : false,
+ "optional" : true,
+ "default" : 1
+ },
+
+ "disallow" : {
+ "type" : ["string", "array"],
+ "items" : {"type" : "string"},
+ "optional" : true,
+ "uniqueItems" : true
+ },
+
+ "extends" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
+ "optional" : true,
+ "default" : {}
+ }
+ },
+
+ "optional" : true,
+ "default" : {}
+}
View
20 draft-03/examples/address
@@ -0,0 +1,20 @@
+{
+ "description" : "An Address following the convention of http://microformats.org/wiki/hcard",
+ "type" : "object",
+ "properties" : {
+ "post-office-box" : { "type" : "string" },
+ "extended-address" : { "type" : "string" },
+ "street-address" : { "type":"string" },
+ "locality" : { "type" : "string", "required" : true },
+ "region" : { "type" : "string", "required" : true },
+ "postal-code" : { "type" : "string" },
+ "country-name" : { "type" : "string", "required" : true }
+ },
+ "dependencies" : {
+ "post-office-box" : "street-address",
+ "extended-address" : "street-address",
+ "street-address" : "region",
+ "locality" : "region",
+ "region" : "country-name"
+ }
+}
View
53 draft-03/examples/calendar
@@ -0,0 +1,53 @@
+{
+ "description" : "A representation of an event",
+ "type" : "object",
+ "properties" : {
+ "dtstart" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Event starting time",
+ "required":true
+ },
+ "summary" : {
+ "type":"string",
+ "required":true
+ },
+ "location" : {
+ "type" : "string"
+ },
+ "url" : {
+ "type" : "string",
+ "format" : "url"
+ },
+ "dtend" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Event ending time"
+ },
+ "duration" : {
+ "format" : "date",
+ "type" : "string",
+ "description" : "Event duration"
+ },
+ "rdate" : {
+ "format" : "date-time",
+ "type" : "string",
+ "description" : "Recurrence date"
+ },
+ "rrule" : {
+ "type" : "string",
+ "description" : "Recurrence rule"
+ },
+ "category" : {
+ "type" : "string"
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "geo" : { "$ref" : "http://json-schema.org/draft-03/geo" }
+ }
+}
+
+
+
+
View
105 draft-03/examples/card
@@ -0,0 +1,105 @@
+{
+ "description":"A representation of a person, company, organization, or place",
+ "type":"object",
+ "properties":{
+ "fn":{
+ "description":"Formatted Name",
+ "type":"string"
+ },
+ "familyName":{
+ "type":"string",
+ "required":true
+ },
+ "givenName":{
+ "type":"string",
+ "required":true
+ },
+ "additionalName":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "honorificPrefix":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "honorificSuffix":{
+ "type":"array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "nickname":{
+ "type":"string"
+ },
+ "url":{
+ "type":"string",
+ "format":"url"
+ },
+ "email":{
+ "type":"object",
+ "properties":{
+ "type":{
+ "type":"string"
+ },
+ "value":{
+ "type":"string",
+ "format":"email"
+ }
+ }
+ },
+ "tel":{
+ "type":"object",
+ "properties":{
+ "type":{
+ "type":"string"
+ },
+ "value":{
+ "type":"string",
+ "format":"phone"
+ }
+ }
+ },
+ "adr":{"$ref" : "http://json-schema.org/address"},
+ "geo":{"$ref" : "http://json-schema.org/geo"},
+ "tz":{
+ "type":"string"
+ },
+ "photo":{
+ "format":"image",
+ "type":"string"
+ },
+ "logo":{
+ "format":"image",
+ "type":"string"
+ },
+ "sound":{
+ "format":"attachment",
+ "type":"string"
+ },
+ "bday":{
+ "type":"string",
+ "format":"date"
+ },
+ "title":{
+ "type":"string"
+ },
+ "role":{
+ "type":"string"
+ },
+ "org":{
+ "type":"object",
+ "properties":{
+ "organizationName":{
+ "type":"string"
+ },
+ "organizationUnit":{
+ "type":"string"
+ }
+ }
+ }
+ }
+}
View
8 draft-03/examples/geo
@@ -0,0 +1,8 @@
+{
+ "description" : "A geographical coordinate",
+ "type" : "object",
+ "properties" : {
+ "latitude" : { "type" : "number" },
+ "longitude" : { "type" : "number" }
+ }
+}
View
4 interfaces → draft-03/examples/interfaces
@@ -12,10 +12,10 @@
"parameters":{
"type":"array",
"description":"The set of parameters that should be passed to the method when it is called",
- "items":"#",
+ "items":{"$ref":"#"},
"required": true
},
- "returns":"#"
+ "returns":{"$ref":"#"}
}
}
}
View
60 draft-03/hyper-schema
@@ -0,0 +1,60 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "extends" : {"$ref" : "http://json-schema.org/draft-03/schema#"}
+ "id" : "http://json-schema.org/draft-03/hyper-schema#",
+
+ "properties" : {
+ "links" : {
+ "type" : "array",
+ "items" : {"$ref" : "http://json-schema.org/draft-03/links#"}
+ },
+
+ "fragmentResolution" : {
+ "type" : "string",
+ "default" : "slash-delimited"
+ },
+
+ "root" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "readonly" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
+ "contentEncoding" : {
+ "type" : "string"
+ },
+
+ "pathStart" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "mediaType" : {
+ "type" : "string",
+ "format" : "media-type"
+ }
+ },
+
+ "links" : [
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ },
+
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ }
+ ],
+
+ "fragmentResolution" : "slash-delimited"
+}
View
26 draft-03/json-ref
@@ -0,0 +1,26 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "id" : "http://json-schema.org/draft-03/json-ref#",
+
+ "additionalItems" : {"$ref" : "#"},
+ "additionalProperties" : {"$ref" : "#"},
+
+ "links" : [
+ {
+ "href" : "{id}",
+ "rel" : "self"
+ },
+
+ {
+ "href" : "{$ref}",
+ "rel" : "full"
+ },
+
+ {
+ "href" : "{$schema}",
+ "rel" : "describedby"
+ }
+ ],
+
+ "fragmentResolution" : "dot-delimited"
+}
View
35 draft-03/links
@@ -0,0 +1,35 @@
+{
+ "$schema" : "http://json-schema.org/draft-03/hyper-schema#",
+ "id" : "http://json-schema.org/draft-03/links#",
+ "type" : "object",
+
+ "properties" : {
+ "href" : {
+ "type" : "string",
+ "required" : true,
+ "format" : "link-description-object-template"
+ },
+
+ "rel" : {
+ "type" : "string",
+ "required" : true
+ },
+
+ "targetSchema" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"},
+
+ "method" : {
+ "type" : "string",
+ "default" : "GET"
+ },
+
+ "enctype" : {
+ "type" : "string",
+ "requires" : "method"
+ },
+
+ "properties" : {
+ "type" : "object",
+ "additionalProperties" : {"$ref" : "http://json-schema.org/draft-03/hyper-schema#"}
+ }
+ }
+}
View
87 schema → draft-03/schema
@@ -1,54 +1,55 @@
{
- "id" : "http://json-schema.org/schema#",
- "type" : ["object","string"],
- "format": "uri",
+ "$schema" : "http://json-schema.org/draft-03/schema#",
+ "id" : "http://json-schema.org/draft-03/schema#",
+ "type" : "object",
"properties" : {
"type" : {
"type" : ["string", "array"],
"items" : {
- "type" : ["string", "#"]
+ "type" : ["string", {"$ref" : "#"}]
},
"uniqueItems" : true,
"default" : "any"
},
"properties" : {
"type" : "object",
- "additionalProperties" : "#",
+ "additionalProperties" : {"$ref" : "#"},
"default" : {}
},
- "items" : {
- "type" : ["#", "array"],
- "items" : "#",
- "default" : {}
- },
-
- "required" : {
- "type" : "boolean",
- "default" : false
- },
-
"patternProperties" : {
"type" : "object",
- "additionalProperties" : "#",
+ "additionalProperties" : {"$ref" : "#"},
"default" : {}
},
"additionalProperties" : {
- "type" : ["#", "boolean"],
+ "type" : [{"$ref" : "#"}, "boolean"],
+ "default" : {}
+ },
+
+ "items" : {
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
"default" : {}
},
+
"additionalItems" : {
- "type" : ["#", "boolean"],
+ "type" : [{"$ref" : "#"}, "boolean"],
"default" : {}
},
+ "required" : {
+ "type" : "boolean",
+ "default" : false
+ },
+
"dependencies" : {
"type" : "object",
"additionalProperties" : {
- "type" : ["array", "#"],
+ "type" : ["string", "array", {"$ref" : "#"}],
"items" : {
"type" : "string"
}
@@ -65,11 +66,13 @@
},
"exclusiveMinimum" : {
- "type" : "number"
+ "type" : "boolean",
+ "default" : false
},
"exclusiveMaximum" : {
- "type" : "number"
+ "type" : "boolean",
+ "default" : false
},
"minItems" : {
@@ -79,7 +82,8 @@
},
"maxItems" : {
- "type" : "integer"
+ "type" : "integer",
+ "minimum" : 0
},
"uniqueItems" : {
@@ -123,37 +127,48 @@
"format" : {
"type" : "string"
},
-
- "maxDecimal" : {
+
+ "divisibleBy" : {
"type" : "number",
- "minimum" : 0
+ "minimum" : 0,
+ "exclusiveMinimum" : true,
+ "default" : 1
},
"disallow" : {
- "type" : ["string", "array", "#"],
+ "type" : ["string", "array"],
"items" : {
- "type" : ["string", "#"]
+ "type" : ["string", {"$ref" : "#"}]
},
"uniqueItems" : true
},
"extends" : {
- "type" : ["#", "array"],
- "items" : "#",
+ "type" : [{"$ref" : "#"}, "array"],
+ "items" : {"$ref" : "#"},
"default" : {}
},
"id" : {
"type" : "string",
"format" : "uri"
+ },
+
+ "$ref" : {
+ "type" : "string",
+ "format" : "uri"
+ },
+
+ "$schema" : {
+ "type" : "string",
+ "format" : "uri"
}
},
- "links" : [
- {
- "href" : "{id}",
- "rel" : "self"
- }
- ],
+
+ "dependencies" : {
+ "exclusiveMinimum" : "minimum",
+ "exclusiveMaximum" : "maximum"
+ },
"default" : {}
}
View
49 draft-zyp-json-schema-03.xml
@@ -246,17 +246,17 @@ collection. However, ultimately, the mechanism for referencing a schema is up to
</t>
<section title="Self-Descriptive Schema">
<t>
- JSON Schemas are themselves instances for the schema
- schemas. A self-describing JSON Schema for the core JSON Schema can
- be found at <eref target="http://json-schema.org/schema">http://json-schema.org/schema</eref>, while the hyper schema
- self-description can be found at <eref target="http://json-schema.org/hyper-schema">http://json-schema.org/hyper-schema</eref>. All schemas
+ JSON Schemas can themselves be described using JSON Schemas.
+ A self-describing JSON Schema for the core JSON Schema can
+ be found at <eref target="http://json-schema.org/draft-03/schema">http://json-schema.org/draft-03/schema</eref>, while the hyper schema
+ self-description can be found at <eref target="http://json-schema.org/draft-03/hyper-schema">http://json-schema.org/draft-03/hyper-schema</eref>. All schemas
used within a protocol with media type definitions
SHOULD include a MIME parameter that refers to the self-descriptive
hyper schema or another schema that extends this hyper schema:
<figure>
<artwork><![CDATA[
Content-Type: application/json;
- profile=http://www.json-schema.org/hyper-schema
+ profile=http://json-schema.org/draft-03/hyper-schema
]]></artwork></figure>
</t>
</section>
@@ -348,7 +348,7 @@ If the property is not defined or is not in this list, then any type of value is
<t>
The dependency value can take one of two forms:
<list style="hanging">
-<t hangText="Simple Dependency">If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array.</t>
+<t hangText="Simple Dependency">If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value. If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array.</t>
<t hangText="Schema Dependency">If the dependency value is a schema, then the instance object MUST be valid against the schema.</t>
</list>
</t>
@@ -384,12 +384,12 @@ The dependency value can take one of two forms:
</section>
<section title="pattern">
<t>When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5</t></section>
-<section title="maxLength">
-<t>When the instance value is a string, this defines the maximum length of the string.</t>
-</section>
<section title="minLength">
<t>When the instance value is a string, this defines the minimum length of the string.</t>
</section>
+<section title="maxLength">
+<t>When the instance value is a string, this defines the maximum length of the string.</t>
+</section>
<section title="enum">
<t>This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in <xref target="uniqueItems">"uniqueItems"</xref>.</t>
</section>
@@ -444,7 +444,7 @@ The dependency value can take one of two forms:
{
"description":"Extended schema",
"properties":{"deprecated":{"type": "boolean"}},
- "extends":"http://json-schema.org/schema"
+ "extends":"http://json-schema.org/draft-03/schema"
}
]]></artwork></figure>
@@ -453,13 +453,30 @@ The dependency value can take one of two forms:
</section>
<section title="id">
<t>
-This defines the URI of this schema (this attribute is effectively
+This attribute defines the URI of this schema (this attribute is effectively
a "self" link). This URI MAY be relative or absolute. If the URI
is relative, it SHOULD be resolved against the URI used to retrieve this schema.
</t>
</section>
+<section title="$ref">
+<t>
+This attribute defines a URI of a schema that contains the full representation of this schema.
+When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance.
+This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema.
+</t>
+</section>
+<section title="$schema">
+<t>
+This attribute defines a URI of a JSON Schema that is the schema of the current schema.
+When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving <xref target="hyper-schema">Hyper Schema</xref> <xref target="links">links</xref>.
+</t>
+<t>
+A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior.
+Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes.
+</t>
+</section>
</section>
-<section title="Hyper Schema">
+<section title="Hyper Schema" anchor="hyper-schema">
<t>The following attributes are specified in addition to those
attributes that already provided by the core schema with the specific
purpose of informing user agents of relations between resources based
@@ -469,7 +486,7 @@ Therefore, an empty object is a valid (non-informative) schema, and
essentially describes plain JSON (no constraints on the structures).
Addition of attributes provides additive information for user agents.</t>
-<section title="links">
+<section title="links" anchor="links">
<t>
The value of the links property MUST be an array, where each item
in the array is a link description object which describes the link
@@ -484,7 +501,7 @@ values. The link description format can be used on its own in
regular (non-schema documents), and use of this format can
be declared by referencing the normative link description
schema as the the schema for the data structure that uses the
-links. The URI of the normative link description schema is: <eref target="http://json-schema.org/links">http://json-schema.org/links</eref>.
+links. The URI of the normative link description schema is: <eref target="http://json-schema.org/draft-03/links">http://json-schema.org/draft-03/links</eref>.
</t>
<section title="href">
<t>
@@ -863,7 +880,7 @@ Content-Type: application/json; profile=/schema-for-this-data
<t>
The value of the profile parameter SHOULD be a URI (relative or absolute) that
refers to the schema used to define the structure of this structure (the
- meta-schema). Normally the value would be http://json-schema.org/hyper-schema,
+ meta-schema). Normally the value would be http://json-schema.org/draft-03/hyper-schema,
but it is allowable to use other schemas that extend the hyper schema's meta-
schema.
</t>
@@ -942,6 +959,8 @@ instead of numbers</t>
<t>Added "id" attribute.</t>
<t>Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template.</t>
<t>Added "patternProperties" attribute.</t>
+ <t>Schema URIs are now namespace versioned.</t>
+ <t>Added "$ref" and "$schema" attributes.</t>
</list>
</t>
<t hangText="draft-02">
View
7 geo
@@ -1,7 +0,0 @@
-{"description":"A geographical coordinate",
- "type":"object",
- "properties":{
- "latitude":{"type":"number"},
- "longitude":{"type":"number"}
- }
-}
View
104 hyper-schema
@@ -1,104 +0,0 @@
-{
- "id" : "http://json-schema.org/hyper-schema",
-
- "properties" : {
- "links" : {
- "type" : "array",
- "items" : "http://json-schema.org/links"
- },
-
- "fragmentResolution" : {
- "type" : "string",
- "default" : "slash-delimited"
- },
-
- "root" : {
- "type" : "boolean",
- "default" : false
- },
-
- "readonly" : {
- "type" : "boolean",
- "default" : false
- },
-
- "pathStart" : {
- "type" : "string",
- "format" : "uri"
- },
-
- "mediaType" : {
- "type" : "string",
- "format" : "media-type"
- },
-
- "alternate" : {
- "type" : "array",
- "items" : "http://json-schema.org/hyper-schema-or-uri"
- },
-
- "type" : {
- "type" : ["string", "array"],
- "items" : {
- "type" : ["string", "http://json-schema.org/hyper-schema-or-uri"]
- },
- "uniqueItems" : true,
- "default" : "any"
- },
-
- "properties" : {
- "type" : "object",
- "additionalProperties" : "http://json-schema.org/hyper-schema-or-uri",
- "default" : {}
- },
-
- "items" : {
- "type" : ["http://json-schema.org/hyper-schema-or-uri", "array"],
- "items" : "http://json-schema.org/hyper-schema-or-uri",
- "default" : {}
- },
- "additionalProperties" : {
- "type" : ["http://json-schema.org/hyper-schema-or-uri", "boolean"],
- "default" : {}
- },
- "additionalItems" : {
- "type" : ["http://json-schema.org/hyper-schema-or-uri", "boolean"],
- "default" : {}
- },
- "contentEncoding" : {
- "type" : "string"
- },
-
- "requires" : {
- "type" : ["string", "http://json-schema.org/hyper-schema-or-uri"]
- },
- "disallow" : {
- "type" : ["string", "array", "http://json-schema.org/hyper-schema-or-uri"],
- "items" : {
- "type" : ["string", "http://json-schema.org/hyper-schema-or-uri"]
- },
- "uniqueItems" : true
- },
- "extends" : {
- "type" : ["http://json-schema.org/hyper-schema-or-uri", "array"],
- "items" : "http://json-schema.org/hyper-schema-or-uri",
- "default" : {}
- }
-
- },
-
- "links" : [
- {
- "href" : "{$schema}",
- "rel" : "describedby"
- },
-
- {
- "href" : "{$ref}",
- "rel" : "full"
- }
- ],
-
- "fragmentResolution" : "dot-delimited",
- "extends" : "http://json-schema.org/schema"
-}
View
34 links
@@ -1,34 +0,0 @@
-{
- "$schema" : "http://json-schema.org/hyper-schema",
- "id" : "http://json-schema.org/links",
- "type" : "object",
-
- "properties" : {
- "href" : {
- "type" : "string",
- "required": true
- },
-
- "rel" : {
- "type" : "string",
- "required": true
- },
-
- "targetSchema" : "http://json-schema.org/hyper-schema",
-
- "method" : {
- "type" : "string",
- "default" : "GET"
- },
-
- "enctype" : {
- "type" : "string",
- "requires" : "method"
- },
-
- "properties" : {
- "type" : "object",
- "additionalProperties" : "http://json-schema.org/hyper-schema"
- }
- }
-}

0 comments on commit 8c1e8af

Please sign in to comment.