Skip to content

Commit ad53a19

Browse files
authored
Merge pull request #376 from iainbeeston/update-draft6-schema-id
Corrected the draf6 schema id
2 parents d611009 + 87e7b0a commit ad53a19

File tree

4 files changed

+41
-37
lines changed

4 files changed

+41
-37
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased]
77

8+
### Fixed
9+
10+
- Corrected the draft6 schema id to `http://json-schema.org/draft/schema#`
11+
812
## [2.8.0] - 2017-02-07
913

1014
### Added

lib/json-schema/validators/draft6.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def initialize
4343
'uri' => UriFormat
4444
}
4545
@formats = @default_formats.clone
46-
@uri = JSON::Util::URI.parse("http://json-schema.org/draft-06/schema#")
47-
@names = ["draft6", "http://json-schema.org/draft-06/schema#"]
46+
@uri = JSON::Util::URI.parse("http://json-schema.org/draft/schema#")
47+
@names = ["draft6", "http://json-schema.org/draft/schema#"]
4848
@metaschema_name = "draft-06.json"
4949
end
5050

resources/draft-06.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"id": "http://json-schema.org/draft-06/schema#",
3-
"$schema": "http://json-schema.org/draft-06/schema#",
4-
"description": "Core schema meta-schema",
2+
"$schema": "http://json-schema.org/draft/schema#",
3+
"$id": "http://json-schema.org/draft/schema#",
4+
"title": "Core schema meta-schema",
55
"definitions": {
66
"schemaArray": {
77
"type": "array",
@@ -13,28 +13,43 @@
1313
"minimum": 0
1414
},
1515
"positiveIntegerDefault0": {
16-
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
16+
"allOf": [
17+
{ "$ref": "#/definitions/positiveInteger" },
18+
{ "default": 0 }
19+
]
1720
},
1821
"simpleTypes": {
19-
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
22+
"enum": [
23+
"array",
24+
"boolean",
25+
"integer",
26+
"null",
27+
"number",
28+
"object",
29+
"string"
30+
]
2031
},
2132
"stringArray": {
2233
"type": "array",
2334
"items": { "type": "string" },
24-
"minItems": 1,
25-
"uniqueItems": true
35+
"uniqueItems": true,
36+
"defaultItems": []
2637
}
2738
},
28-
"type": "object",
39+
"type": ["object", "boolean"],
2940
"properties": {
30-
"id": {
41+
"$id": {
3142
"type": "string",
32-
"format": "uri"
43+
"format": "uri-reference"
3344
},
3445
"$schema": {
3546
"type": "string",
3647
"format": "uri"
3748
},
49+
"$ref": {
50+
"type": "string",
51+
"format": "uri-reference"
52+
},
3853
"title": {
3954
"type": "string"
4055
},
@@ -44,36 +59,27 @@
4459
"default": {},
4560
"multipleOf": {
4661
"type": "number",
47-
"minimum": 0,
48-
"exclusiveMinimum": true
62+
"exclusiveMinimum": 0
4963
},
5064
"maximum": {
5165
"type": "number"
5266
},
5367
"exclusiveMaximum": {
54-
"type": "boolean",
55-
"default": false
68+
"type": "number"
5669
},
5770
"minimum": {
5871
"type": "number"
5972
},
6073
"exclusiveMinimum": {
61-
"type": "boolean",
62-
"default": false
74+
"type": "number"
6375
},
6476
"maxLength": { "$ref": "#/definitions/positiveInteger" },
6577
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
6678
"pattern": {
6779
"type": "string",
6880
"format": "regex"
6981
},
70-
"additionalItems": {
71-
"anyOf": [
72-
{ "type": "boolean" },
73-
{ "$ref": "#" }
74-
],
75-
"default": {}
76-
},
82+
"additionalItems": { "$ref": "#" },
7783
"items": {
7884
"anyOf": [
7985
{ "$ref": "#" },
@@ -87,16 +93,11 @@
8793
"type": "boolean",
8894
"default": false
8995
},
96+
"contains": { "$ref": "#" },
9097
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
9198
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
9299
"required": { "$ref": "#/definitions/stringArray" },
93-
"additionalProperties": {
94-
"anyOf": [
95-
{ "type": "boolean" },
96-
{ "$ref": "#" }
97-
],
98-
"default": {}
99-
},
100+
"additionalProperties": { "$ref": "#" },
100101
"definitions": {
101102
"type": "object",
102103
"additionalProperties": { "$ref": "#" },
@@ -121,6 +122,8 @@
121122
]
122123
}
123124
},
125+
"propertyNames": { "$ref": "#" },
126+
"const": {},
124127
"enum": {
125128
"type": "array",
126129
"minItems": 1,
@@ -137,14 +140,11 @@
137140
}
138141
]
139142
},
143+
"format": { "type": "string" },
140144
"allOf": { "$ref": "#/definitions/schemaArray" },
141145
"anyOf": { "$ref": "#/definitions/schemaArray" },
142146
"oneOf": { "$ref": "#/definitions/schemaArray" },
143147
"not": { "$ref": "#" }
144148
},
145-
"dependencies": {
146-
"exclusiveMaximum": [ "maximum" ],
147-
"exclusiveMinimum": [ "minimum" ]
148-
},
149149
"default": {}
150150
}

test/custom_format_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def setup
66
@all_versions = ['draft1', 'draft2', 'draft3', 'draft4', 'draft6', nil]
77
@format_proc = lambda { |value| raise JSON::Schema::CustomFormatError.new("must be 42") unless value == "42" }
88
@schema_6 = {
9-
"$schema" => "http://json-schema.org/draft-06/schema#",
9+
"$schema" => "http://json-schema.org/draft/schema#",
1010
"properties" => {
1111
"a" => {
1212
"type" => "string",

0 commit comments

Comments
 (0)