Skip to content

Commit ec90855

Browse files
authored
Fail validation on invalid reference exception (#121)
1 parent 87919a4 commit ec90855

13 files changed

+2953
-3098
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.12.34] - 2021-06-17
8+
9+
### Fixed
10+
- Suppressed failure during reference resolution.
11+
12+
## [0.12.33] - 2021-05-27
13+
14+
### Fixed
15+
- Disable validation for default and const values.
16+
17+
## [0.12.32] - 2021-05-12
18+
19+
### Fixed
20+
- Suppressed failure during validation in referenced schema.
21+
722
## [0.12.31] - 2020-09-21
823

924
### Fixed
@@ -68,6 +83,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6883
### Changed
6984
- Export `null` value instead of skipping it for properties having `null` type.
7085

86+
[0.12.34]: https://github.com/swaggest/php-json-schema/compare/v0.12.33...v0.12.34
87+
[0.12.33]: https://github.com/swaggest/php-json-schema/compare/v0.12.32...v0.12.33
88+
[0.12.32]: https://github.com/swaggest/php-json-schema/compare/v0.12.31...v0.12.32
7189
[0.12.31]: https://github.com/swaggest/php-json-schema/compare/v0.12.30...v0.12.31
7290
[0.12.30]: https://github.com/swaggest/php-json-schema/compare/v0.12.29...v0.12.30
7391
[0.12.29]: https://github.com/swaggest/php-json-schema/compare/v0.12.28...v0.12.29

spec/json-schema-draft6.json

+46-153
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,47 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/schema#",
3-
"$id": "http://json-schema.org/draft-06/schema#",
4-
"title": "Core schema meta-schema",
5-
"definitions": {
6-
"schemaArray": {
7-
"type": "array",
8-
"minItems": 1,
9-
"items": { "$ref": "#" }
10-
},
11-
"nonNegativeInteger": {
12-
"type": "integer",
13-
"minimum": 0
14-
},
15-
"nonNegativeIntegerDefault0": {
16-
"allOf": [
17-
{ "$ref": "#/definitions/nonNegativeInteger" },
18-
{ "default": 0 }
19-
]
20-
},
21-
"simpleTypes": {
22-
"enum": [
23-
"array",
24-
"boolean",
25-
"integer",
26-
"null",
27-
"number",
28-
"object",
29-
"string"
30-
]
31-
},
32-
"stringArray": {
33-
"type": "array",
34-
"items": { "type": "string" },
35-
"uniqueItems": true,
36-
"default": []
37-
}
38-
},
39-
"type": ["object", "boolean"],
40-
"properties": {
41-
"$id": {
42-
"type": "string",
43-
"format": "uri-reference"
44-
},
45-
"$schema": {
46-
"type": "string",
47-
"format": "uri"
48-
},
49-
"$ref": {
50-
"type": "string",
51-
"format": "uri-reference"
52-
},
53-
"title": {
54-
"type": "string"
55-
},
56-
"description": {
57-
"type": "string"
58-
},
59-
"default": {},
60-
"examples": {
61-
"type": "array",
62-
"items": {}
63-
},
64-
"multipleOf": {
65-
"type": "number",
66-
"exclusiveMinimum": 0
67-
},
68-
"maximum": {
69-
"type": "number"
70-
},
71-
"exclusiveMaximum": {
72-
"type": "number"
73-
},
74-
"minimum": {
75-
"type": "number"
76-
},
77-
"exclusiveMinimum": {
78-
"type": "number"
79-
},
80-
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
81-
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
82-
"pattern": {
83-
"type": "string",
84-
"format": "regex"
85-
},
86-
"additionalItems": { "$ref": "#" },
87-
"items": {
88-
"anyOf": [
89-
{ "$ref": "#" },
90-
{ "$ref": "#/definitions/schemaArray" }
91-
],
92-
"default": {}
93-
},
94-
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
95-
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
96-
"uniqueItems": {
97-
"type": "boolean",
98-
"default": false
99-
},
100-
"contains": { "$ref": "#" },
101-
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
102-
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
103-
"required": { "$ref": "#/definitions/stringArray" },
104-
"additionalProperties": { "$ref": "#" },
105-
"definitions": {
106-
"type": "object",
107-
"additionalProperties": { "$ref": "#" },
108-
"default": {}
109-
},
110-
"properties": {
111-
"type": "object",
112-
"additionalProperties": { "$ref": "#" },
113-
"default": {}
114-
},
115-
"patternProperties": {
116-
"type": "object",
117-
"additionalProperties": { "$ref": "#" },
118-
"default": {}
119-
},
120-
"dependencies": {
121-
"type": "object",
122-
"additionalProperties": {
123-
"anyOf": [
124-
{ "$ref": "#" },
125-
{ "$ref": "#/definitions/stringArray" }
126-
]
127-
}
128-
},
129-
"propertyNames": { "$ref": "#" },
130-
"const": {},
131-
"enum": {
132-
"type": "array",
133-
"minItems": 1,
134-
"uniqueItems": true
135-
},
136-
"type": {
137-
"anyOf": [
138-
{ "$ref": "#/definitions/simpleTypes" },
139-
{
140-
"type": "array",
141-
"items": { "$ref": "#/definitions/simpleTypes" },
142-
"minItems": 1,
143-
"uniqueItems": true
144-
}
145-
]
146-
},
147-
"format": { "type": "string" },
148-
"allOf": { "$ref": "#/definitions/schemaArray" },
149-
"anyOf": { "$ref": "#/definitions/schemaArray" },
150-
"oneOf": { "$ref": "#/definitions/schemaArray" },
151-
"not": { "$ref": "#" }
152-
},
153-
"default": {}
154-
}
2+
"$schema":"http://json-schema.org/draft-06/schema#",
3+
"$id":"http://json-schema.org/draft-06/schema#","title":"Core schema meta-schema",
4+
"definitions":{
5+
"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},
6+
"nonNegativeInteger":{"type":"integer","minimum":0},
7+
"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},
8+
"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},
9+
"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}
10+
},
11+
"type":["object","boolean"],
12+
"properties":{
13+
"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},
14+
"$ref":{"type":"string","format":"uri-reference"},"title":{"type":"string"},
15+
"description":{"type":"string"},"default":{},"examples":{"type":"array","items":{}},
16+
"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},
17+
"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},
18+
"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},
19+
"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},
20+
"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},
21+
"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},
22+
"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},
23+
"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},
24+
"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},
25+
"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},
26+
"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},
27+
"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},
28+
"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},
29+
"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},
30+
"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},
31+
"dependencies":{
32+
"type":"object",
33+
"additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}
34+
},
35+
"propertyNames":{"$ref":"#"},"const":{},"enum":{"type":"array","minItems":1,"uniqueItems":true},
36+
"type":{
37+
"anyOf":[
38+
{"$ref":"#/definitions/simpleTypes"},
39+
{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}
40+
]
41+
},
42+
"format":{"type":"string"},"allOf":{"$ref":"#/definitions/schemaArray"},
43+
"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},
44+
"not":{"$ref":"#"}
45+
},
46+
"default":{}
47+
}

0 commit comments

Comments
 (0)