json_schemer 0.2.9 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3 -9
  3. data/Gemfile.lock +6 -6
  4. data/json_schemer.gemspec +2 -2
  5. data/lib/json_schemer.rb +2 -0
  6. data/lib/json_schemer/errors.rb +31 -0
  7. data/lib/json_schemer/schema/base.rb +13 -16
  8. data/lib/json_schemer/version.rb +1 -1
  9. metadata +5 -234
  10. data/JSON-Schema-Test-Suite/.gitignore +0 -1
  11. data/JSON-Schema-Test-Suite/.travis.yml +0 -8
  12. data/JSON-Schema-Test-Suite/LICENSE +0 -19
  13. data/JSON-Schema-Test-Suite/README.md +0 -181
  14. data/JSON-Schema-Test-Suite/bin/jsonschema_suite +0 -298
  15. data/JSON-Schema-Test-Suite/index.js +0 -45
  16. data/JSON-Schema-Test-Suite/package.json +0 -28
  17. data/JSON-Schema-Test-Suite/remotes/folder/folderInteger.json +0 -3
  18. data/JSON-Schema-Test-Suite/remotes/integer.json +0 -3
  19. data/JSON-Schema-Test-Suite/remotes/name-defs.json +0 -15
  20. data/JSON-Schema-Test-Suite/remotes/name.json +0 -15
  21. data/JSON-Schema-Test-Suite/remotes/subSchemas.json +0 -8
  22. data/JSON-Schema-Test-Suite/test-schema.json +0 -59
  23. data/JSON-Schema-Test-Suite/tests/draft2019-09/additionalItems.json +0 -87
  24. data/JSON-Schema-Test-Suite/tests/draft2019-09/additionalProperties.json +0 -133
  25. data/JSON-Schema-Test-Suite/tests/draft2019-09/allOf.json +0 -218
  26. data/JSON-Schema-Test-Suite/tests/draft2019-09/anchor.json +0 -87
  27. data/JSON-Schema-Test-Suite/tests/draft2019-09/anyOf.json +0 -189
  28. data/JSON-Schema-Test-Suite/tests/draft2019-09/boolean_schema.json +0 -104
  29. data/JSON-Schema-Test-Suite/tests/draft2019-09/const.json +0 -170
  30. data/JSON-Schema-Test-Suite/tests/draft2019-09/contains.json +0 -95
  31. data/JSON-Schema-Test-Suite/tests/draft2019-09/default.json +0 -49
  32. data/JSON-Schema-Test-Suite/tests/draft2019-09/defs.json +0 -24
  33. data/JSON-Schema-Test-Suite/tests/draft2019-09/dependencies.json +0 -268
  34. data/JSON-Schema-Test-Suite/tests/draft2019-09/enum.json +0 -179
  35. data/JSON-Schema-Test-Suite/tests/draft2019-09/exclusiveMaximum.json +0 -30
  36. data/JSON-Schema-Test-Suite/tests/draft2019-09/exclusiveMinimum.json +0 -30
  37. data/JSON-Schema-Test-Suite/tests/draft2019-09/format.json +0 -614
  38. data/JSON-Schema-Test-Suite/tests/draft2019-09/if-then-else.json +0 -188
  39. data/JSON-Schema-Test-Suite/tests/draft2019-09/items.json +0 -250
  40. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxItems.json +0 -28
  41. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxLength.json +0 -33
  42. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxProperties.json +0 -38
  43. data/JSON-Schema-Test-Suite/tests/draft2019-09/maximum.json +0 -28
  44. data/JSON-Schema-Test-Suite/tests/draft2019-09/minItems.json +0 -28
  45. data/JSON-Schema-Test-Suite/tests/draft2019-09/minLength.json +0 -33
  46. data/JSON-Schema-Test-Suite/tests/draft2019-09/minProperties.json +0 -38
  47. data/JSON-Schema-Test-Suite/tests/draft2019-09/minimum.json +0 -59
  48. data/JSON-Schema-Test-Suite/tests/draft2019-09/multipleOf.json +0 -60
  49. data/JSON-Schema-Test-Suite/tests/draft2019-09/not.json +0 -117
  50. data/JSON-Schema-Test-Suite/tests/draft2019-09/oneOf.json +0 -206
  51. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/bignum.json +0 -105
  52. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/content.json +0 -77
  53. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/ecmascript-regex.json +0 -213
  54. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/date-time.json +0 -53
  55. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/date.json +0 -23
  56. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/email.json +0 -18
  57. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/hostname.json +0 -33
  58. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/idn-email.json +0 -18
  59. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/idn-hostname.json +0 -28
  60. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/ipv4.json +0 -33
  61. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/ipv6.json +0 -28
  62. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/iri-reference.json +0 -43
  63. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/iri.json +0 -53
  64. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/json-pointer.json +0 -168
  65. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/regex.json +0 -18
  66. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/relative-json-pointer.json +0 -33
  67. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/time.json +0 -23
  68. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri-reference.json +0 -43
  69. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri-template.json +0 -28
  70. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri.json +0 -103
  71. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/zeroTerminatedFloats.json +0 -15
  72. data/JSON-Schema-Test-Suite/tests/draft2019-09/pattern.json +0 -34
  73. data/JSON-Schema-Test-Suite/tests/draft2019-09/patternProperties.json +0 -151
  74. data/JSON-Schema-Test-Suite/tests/draft2019-09/properties.json +0 -167
  75. data/JSON-Schema-Test-Suite/tests/draft2019-09/propertyNames.json +0 -78
  76. data/JSON-Schema-Test-Suite/tests/draft2019-09/ref.json +0 -359
  77. data/JSON-Schema-Test-Suite/tests/draft2019-09/refRemote.json +0 -167
  78. data/JSON-Schema-Test-Suite/tests/draft2019-09/required.json +0 -105
  79. data/JSON-Schema-Test-Suite/tests/draft2019-09/type.json +0 -464
  80. data/JSON-Schema-Test-Suite/tests/draft2019-09/uniqueItems.json +0 -173
  81. data/JSON-Schema-Test-Suite/tests/draft3/additionalItems.json +0 -82
  82. data/JSON-Schema-Test-Suite/tests/draft3/additionalProperties.json +0 -133
  83. data/JSON-Schema-Test-Suite/tests/draft3/default.json +0 -49
  84. data/JSON-Schema-Test-Suite/tests/draft3/dependencies.json +0 -118
  85. data/JSON-Schema-Test-Suite/tests/draft3/disallow.json +0 -80
  86. data/JSON-Schema-Test-Suite/tests/draft3/divisibleBy.json +0 -60
  87. data/JSON-Schema-Test-Suite/tests/draft3/enum.json +0 -71
  88. data/JSON-Schema-Test-Suite/tests/draft3/extends.json +0 -94
  89. data/JSON-Schema-Test-Suite/tests/draft3/format.json +0 -362
  90. data/JSON-Schema-Test-Suite/tests/draft3/items.json +0 -46
  91. data/JSON-Schema-Test-Suite/tests/draft3/maxItems.json +0 -28
  92. data/JSON-Schema-Test-Suite/tests/draft3/maxLength.json +0 -33
  93. data/JSON-Schema-Test-Suite/tests/draft3/maximum.json +0 -42
  94. data/JSON-Schema-Test-Suite/tests/draft3/minItems.json +0 -28
  95. data/JSON-Schema-Test-Suite/tests/draft3/minLength.json +0 -33
  96. data/JSON-Schema-Test-Suite/tests/draft3/minimum.json +0 -73
  97. data/JSON-Schema-Test-Suite/tests/draft3/optional/bignum.json +0 -107
  98. data/JSON-Schema-Test-Suite/tests/draft3/optional/ecmascript-regex.json +0 -18
  99. data/JSON-Schema-Test-Suite/tests/draft3/optional/format.json +0 -227
  100. data/JSON-Schema-Test-Suite/tests/draft3/optional/zeroTerminatedFloats.json +0 -15
  101. data/JSON-Schema-Test-Suite/tests/draft3/pattern.json +0 -34
  102. data/JSON-Schema-Test-Suite/tests/draft3/patternProperties.json +0 -115
  103. data/JSON-Schema-Test-Suite/tests/draft3/properties.json +0 -97
  104. data/JSON-Schema-Test-Suite/tests/draft3/ref.json +0 -192
  105. data/JSON-Schema-Test-Suite/tests/draft3/refRemote.json +0 -74
  106. data/JSON-Schema-Test-Suite/tests/draft3/required.json +0 -53
  107. data/JSON-Schema-Test-Suite/tests/draft3/type.json +0 -489
  108. data/JSON-Schema-Test-Suite/tests/draft3/uniqueItems.json +0 -163
  109. data/JSON-Schema-Test-Suite/tests/draft4/additionalItems.json +0 -87
  110. data/JSON-Schema-Test-Suite/tests/draft4/additionalProperties.json +0 -133
  111. data/JSON-Schema-Test-Suite/tests/draft4/allOf.json +0 -185
  112. data/JSON-Schema-Test-Suite/tests/draft4/anyOf.json +0 -156
  113. data/JSON-Schema-Test-Suite/tests/draft4/default.json +0 -49
  114. data/JSON-Schema-Test-Suite/tests/draft4/definitions.json +0 -32
  115. data/JSON-Schema-Test-Suite/tests/draft4/dependencies.json +0 -194
  116. data/JSON-Schema-Test-Suite/tests/draft4/enum.json +0 -179
  117. data/JSON-Schema-Test-Suite/tests/draft4/format.json +0 -218
  118. data/JSON-Schema-Test-Suite/tests/draft4/items.json +0 -195
  119. data/JSON-Schema-Test-Suite/tests/draft4/maxItems.json +0 -28
  120. data/JSON-Schema-Test-Suite/tests/draft4/maxLength.json +0 -33
  121. data/JSON-Schema-Test-Suite/tests/draft4/maxProperties.json +0 -38
  122. data/JSON-Schema-Test-Suite/tests/draft4/maximum.json +0 -73
  123. data/JSON-Schema-Test-Suite/tests/draft4/minItems.json +0 -28
  124. data/JSON-Schema-Test-Suite/tests/draft4/minLength.json +0 -33
  125. data/JSON-Schema-Test-Suite/tests/draft4/minProperties.json +0 -38
  126. data/JSON-Schema-Test-Suite/tests/draft4/minimum.json +0 -104
  127. data/JSON-Schema-Test-Suite/tests/draft4/multipleOf.json +0 -60
  128. data/JSON-Schema-Test-Suite/tests/draft4/not.json +0 -96
  129. data/JSON-Schema-Test-Suite/tests/draft4/oneOf.json +0 -162
  130. data/JSON-Schema-Test-Suite/tests/draft4/optional/bignum.json +0 -107
  131. data/JSON-Schema-Test-Suite/tests/draft4/optional/ecmascript-regex.json +0 -213
  132. data/JSON-Schema-Test-Suite/tests/draft4/optional/format.json +0 -253
  133. data/JSON-Schema-Test-Suite/tests/draft4/optional/zeroTerminatedFloats.json +0 -15
  134. data/JSON-Schema-Test-Suite/tests/draft4/pattern.json +0 -34
  135. data/JSON-Schema-Test-Suite/tests/draft4/patternProperties.json +0 -120
  136. data/JSON-Schema-Test-Suite/tests/draft4/properties.json +0 -136
  137. data/JSON-Schema-Test-Suite/tests/draft4/ref.json +0 -411
  138. data/JSON-Schema-Test-Suite/tests/draft4/refRemote.json +0 -171
  139. data/JSON-Schema-Test-Suite/tests/draft4/required.json +0 -89
  140. data/JSON-Schema-Test-Suite/tests/draft4/type.json +0 -464
  141. data/JSON-Schema-Test-Suite/tests/draft4/uniqueItems.json +0 -173
  142. data/JSON-Schema-Test-Suite/tests/draft6/additionalItems.json +0 -87
  143. data/JSON-Schema-Test-Suite/tests/draft6/additionalProperties.json +0 -133
  144. data/JSON-Schema-Test-Suite/tests/draft6/allOf.json +0 -218
  145. data/JSON-Schema-Test-Suite/tests/draft6/anyOf.json +0 -189
  146. data/JSON-Schema-Test-Suite/tests/draft6/boolean_schema.json +0 -104
  147. data/JSON-Schema-Test-Suite/tests/draft6/const.json +0 -170
  148. data/JSON-Schema-Test-Suite/tests/draft6/contains.json +0 -100
  149. data/JSON-Schema-Test-Suite/tests/draft6/default.json +0 -49
  150. data/JSON-Schema-Test-Suite/tests/draft6/definitions.json +0 -32
  151. data/JSON-Schema-Test-Suite/tests/draft6/dependencies.json +0 -268
  152. data/JSON-Schema-Test-Suite/tests/draft6/enum.json +0 -179
  153. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMaximum.json +0 -30
  154. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMinimum.json +0 -30
  155. data/JSON-Schema-Test-Suite/tests/draft6/format.json +0 -326
  156. data/JSON-Schema-Test-Suite/tests/draft6/items.json +0 -250
  157. data/JSON-Schema-Test-Suite/tests/draft6/maxItems.json +0 -28
  158. data/JSON-Schema-Test-Suite/tests/draft6/maxLength.json +0 -33
  159. data/JSON-Schema-Test-Suite/tests/draft6/maxProperties.json +0 -38
  160. data/JSON-Schema-Test-Suite/tests/draft6/maximum.json +0 -28
  161. data/JSON-Schema-Test-Suite/tests/draft6/minItems.json +0 -28
  162. data/JSON-Schema-Test-Suite/tests/draft6/minLength.json +0 -33
  163. data/JSON-Schema-Test-Suite/tests/draft6/minProperties.json +0 -38
  164. data/JSON-Schema-Test-Suite/tests/draft6/minimum.json +0 -59
  165. data/JSON-Schema-Test-Suite/tests/draft6/multipleOf.json +0 -60
  166. data/JSON-Schema-Test-Suite/tests/draft6/not.json +0 -117
  167. data/JSON-Schema-Test-Suite/tests/draft6/oneOf.json +0 -206
  168. data/JSON-Schema-Test-Suite/tests/draft6/optional/bignum.json +0 -105
  169. data/JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json +0 -213
  170. data/JSON-Schema-Test-Suite/tests/draft6/optional/format.json +0 -491
  171. data/JSON-Schema-Test-Suite/tests/draft6/optional/zeroTerminatedFloats.json +0 -15
  172. data/JSON-Schema-Test-Suite/tests/draft6/pattern.json +0 -34
  173. data/JSON-Schema-Test-Suite/tests/draft6/patternProperties.json +0 -151
  174. data/JSON-Schema-Test-Suite/tests/draft6/properties.json +0 -167
  175. data/JSON-Schema-Test-Suite/tests/draft6/propertyNames.json +0 -78
  176. data/JSON-Schema-Test-Suite/tests/draft6/ref.json +0 -443
  177. data/JSON-Schema-Test-Suite/tests/draft6/refRemote.json +0 -171
  178. data/JSON-Schema-Test-Suite/tests/draft6/required.json +0 -105
  179. data/JSON-Schema-Test-Suite/tests/draft6/type.json +0 -464
  180. data/JSON-Schema-Test-Suite/tests/draft6/uniqueItems.json +0 -173
  181. data/JSON-Schema-Test-Suite/tests/draft7/additionalItems.json +0 -87
  182. data/JSON-Schema-Test-Suite/tests/draft7/additionalProperties.json +0 -133
  183. data/JSON-Schema-Test-Suite/tests/draft7/allOf.json +0 -218
  184. data/JSON-Schema-Test-Suite/tests/draft7/anyOf.json +0 -189
  185. data/JSON-Schema-Test-Suite/tests/draft7/boolean_schema.json +0 -104
  186. data/JSON-Schema-Test-Suite/tests/draft7/const.json +0 -170
  187. data/JSON-Schema-Test-Suite/tests/draft7/contains.json +0 -100
  188. data/JSON-Schema-Test-Suite/tests/draft7/default.json +0 -49
  189. data/JSON-Schema-Test-Suite/tests/draft7/definitions.json +0 -32
  190. data/JSON-Schema-Test-Suite/tests/draft7/dependencies.json +0 -268
  191. data/JSON-Schema-Test-Suite/tests/draft7/enum.json +0 -179
  192. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMaximum.json +0 -30
  193. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMinimum.json +0 -30
  194. data/JSON-Schema-Test-Suite/tests/draft7/format.json +0 -614
  195. data/JSON-Schema-Test-Suite/tests/draft7/if-then-else.json +0 -188
  196. data/JSON-Schema-Test-Suite/tests/draft7/items.json +0 -250
  197. data/JSON-Schema-Test-Suite/tests/draft7/maxItems.json +0 -28
  198. data/JSON-Schema-Test-Suite/tests/draft7/maxLength.json +0 -33
  199. data/JSON-Schema-Test-Suite/tests/draft7/maxProperties.json +0 -38
  200. data/JSON-Schema-Test-Suite/tests/draft7/maximum.json +0 -28
  201. data/JSON-Schema-Test-Suite/tests/draft7/minItems.json +0 -28
  202. data/JSON-Schema-Test-Suite/tests/draft7/minLength.json +0 -33
  203. data/JSON-Schema-Test-Suite/tests/draft7/minProperties.json +0 -38
  204. data/JSON-Schema-Test-Suite/tests/draft7/minimum.json +0 -59
  205. data/JSON-Schema-Test-Suite/tests/draft7/multipleOf.json +0 -60
  206. data/JSON-Schema-Test-Suite/tests/draft7/not.json +0 -117
  207. data/JSON-Schema-Test-Suite/tests/draft7/oneOf.json +0 -206
  208. data/JSON-Schema-Test-Suite/tests/draft7/optional/bignum.json +0 -105
  209. data/JSON-Schema-Test-Suite/tests/draft7/optional/content.json +0 -77
  210. data/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json +0 -213
  211. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date-time.json +0 -53
  212. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date.json +0 -23
  213. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/email.json +0 -18
  214. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/hostname.json +0 -33
  215. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-email.json +0 -18
  216. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-hostname.json +0 -28
  217. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv4.json +0 -33
  218. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv6.json +0 -28
  219. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri-reference.json +0 -43
  220. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri.json +0 -53
  221. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/json-pointer.json +0 -168
  222. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/regex.json +0 -18
  223. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/relative-json-pointer.json +0 -33
  224. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/time.json +0 -23
  225. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-reference.json +0 -43
  226. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-template.json +0 -28
  227. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri.json +0 -103
  228. data/JSON-Schema-Test-Suite/tests/draft7/optional/zeroTerminatedFloats.json +0 -15
  229. data/JSON-Schema-Test-Suite/tests/draft7/pattern.json +0 -34
  230. data/JSON-Schema-Test-Suite/tests/draft7/patternProperties.json +0 -151
  231. data/JSON-Schema-Test-Suite/tests/draft7/properties.json +0 -167
  232. data/JSON-Schema-Test-Suite/tests/draft7/propertyNames.json +0 -78
  233. data/JSON-Schema-Test-Suite/tests/draft7/ref.json +0 -443
  234. data/JSON-Schema-Test-Suite/tests/draft7/refRemote.json +0 -171
  235. data/JSON-Schema-Test-Suite/tests/draft7/required.json +0 -105
  236. data/JSON-Schema-Test-Suite/tests/draft7/type.json +0 -464
  237. data/JSON-Schema-Test-Suite/tests/draft7/uniqueItems.json +0 -173
  238. data/JSON-Schema-Test-Suite/tests/latest +0 -1
  239. data/JSON-Schema-Test-Suite/tox.ini +0 -9
@@ -1 +0,0 @@
1
- TODO
@@ -1,8 +0,0 @@
1
- language: python
2
- python: "3.7"
3
- node_js: "9"
4
- install:
5
- - pip install tox
6
- script:
7
- - tox
8
- - npm install && npm test || true
@@ -1,19 +0,0 @@
1
- Copyright (c) 2012 Julian Berman
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,181 +0,0 @@
1
- JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite.svg?branch=master)](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite)
2
- ======================
3
-
4
- This repository contains a set of JSON objects that implementors of JSON Schema
5
- validation libraries can use to test their validators.
6
-
7
- It is meant to be language agnostic and should require only a JSON parser.
8
-
9
- The conversion of the JSON objects into tests within your test framework of
10
- choice is still the job of the validator implementor.
11
-
12
- Structure of a Test
13
- -------------------
14
-
15
- If you're going to use this suite, you need to know how tests are laid out. The
16
- tests are contained in the `tests` directory at the root of this repository.
17
-
18
- Inside that directory is a subdirectory for each draft or version of the
19
- schema.
20
-
21
- If you look inside the draft directory, there are a number of `.json` files,
22
- which logically group a set of test cases together. Often the grouping is by
23
- property under test, but not always, especially within optional test files
24
- (discussed below).
25
-
26
- Inside each `.json` file is a single array containing objects. It's easiest to
27
- illustrate the structure of these with an example:
28
-
29
- ```json
30
- {
31
- "description": "the description of the test case",
32
- "schema": {"the schema that should" : "be validated against"},
33
- "tests": [
34
- {
35
- "description": "a specific test of a valid instance",
36
- "data": "the instance",
37
- "valid": true
38
- },
39
- {
40
- "description": "another specific test this time, invalid",
41
- "data": 15,
42
- "valid": false
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- So a description, a schema, and some tests, where tests is an array containing
49
- one or more objects with descriptions, data, and a boolean indicating whether
50
- they should be valid or invalid.
51
-
52
- Coverage
53
- --------
54
-
55
- Drafts 03, 04, 06, and 07 should have full coverage, with drafts 06 and 07
56
- being considered current and actively supported. Bug fixes will be made as
57
- needed for draft-04 as it is still the most widely used, while draft-03
58
- is long since deprecated.
59
-
60
- If you see anything missing from the current supported drafts, or incorrect
61
- on any draft still accepting bug fixes, please file an issue or submit a PR.
62
-
63
- Who Uses the Test Suite
64
- -----------------------
65
-
66
- This suite is being used by:
67
-
68
- ### Clojure ###
69
-
70
- * [jinx](https://github.com/juxt/jinx)
71
- * [json-schema](https://github.com/tatut/json-schema)
72
-
73
- ### Coffeescript ###
74
-
75
- * [jsck](https://github.com/pandastrike/jsck)
76
-
77
- ### C++ ###
78
-
79
- * [Modern C++ JSON schema validator](https://github.com/pboettch/json-schema-validator)
80
-
81
- ### Dart ###
82
-
83
- * [json_schema](https://github.com/patefacio/json_schema)
84
-
85
- ### Elixir ###
86
-
87
- * [ex_json_schema](https://github.com/jonasschmidt/ex_json_schema)
88
-
89
- ### Erlang ###
90
-
91
- * [jesse](https://github.com/for-GET/jesse)
92
-
93
- ### Go ###
94
-
95
- * [gojsonschema](https://github.com/sigu-399/gojsonschema)
96
- * [validate-json](https://github.com/cesanta/validate-json)
97
-
98
- ### Haskell ###
99
-
100
- * [aeson-schema](https://github.com/timjb/aeson-schema)
101
- * [hjsonschema](https://github.com/seagreen/hjsonschema)
102
-
103
- ### Java ###
104
-
105
- * [json-schema-validator](https://github.com/daveclayton/json-schema-validator)
106
- * [everit-org/json-schema](https://github.com/everit-org/json-schema)
107
- * [networknt/json-schema-validator](https://github.com/networknt/json-schema-validator)
108
- * [Justify](https://github.com/leadpony/justify)
109
-
110
- ### JavaScript ###
111
-
112
- * [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
113
- * [direct-schema](https://github.com/IreneKnapp/direct-schema)
114
- * [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)
115
- * [jassi](https://github.com/iclanzan/jassi)
116
- * [JaySchema](https://github.com/natesilva/jayschema)
117
- * [json-schema-valid](https://github.com/ericgj/json-schema-valid)
118
- * [Jsonary](https://github.com/jsonary-js/jsonary)
119
- * [jsonschema](https://github.com/tdegrunt/jsonschema)
120
- * [request-validator](https://github.com/bugventure/request-validator)
121
- * [skeemas](https://github.com/Prestaul/skeemas)
122
- * [tv4](https://github.com/geraintluff/tv4)
123
- * [z-schema](https://github.com/zaggino/z-schema)
124
- * [jsen](https://github.com/bugventure/jsen)
125
- * [ajv](https://github.com/epoberezkin/ajv)
126
- * [djv](https://github.com/korzio/djv)
127
-
128
- ### Node.js ###
129
-
130
- For node.js developers, the suite is also available as an
131
- [npm](https://www.npmjs.com/package/@json-schema-org/tests) package.
132
-
133
- Node-specific support is maintained in a [separate
134
- repository](https://github.com/json-schema-org/json-schema-test-suite-npm)
135
- which also welcomes your contributions!
136
-
137
- ### .NET ###
138
-
139
- * [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)
140
- * [Manatee.Json](https://github.com/gregsdennis/Manatee.Json)
141
-
142
- ### PHP ###
143
-
144
- * [json-schema](https://github.com/justinrainbow/json-schema)
145
- * [json-guard](https://github.com/thephpleague/json-guard)
146
-
147
- ### PostgreSQL ###
148
-
149
- * [postgres-json-schema](https://github.com/gavinwahl/postgres-json-schema)
150
- * [is_jsonb_valid](https://github.com/furstenheim/is_jsonb_valid)
151
-
152
- ### Python ###
153
-
154
- * [jsonschema](https://github.com/Julian/jsonschema)
155
- * [fastjsonschema](https://github.com/seznam/python-fastjsonschema)
156
- * [hypothesis-jsonschema](https://github.com/Zac-HD/hypothesis-jsonschema)
157
-
158
- ### Ruby ###
159
-
160
- * [json-schema](https://github.com/hoxworth/json-schema)
161
- * [json_schemer](https://github.com/davishmcclurg/json_schemer)
162
-
163
- ### Rust ###
164
-
165
- * [valico](https://github.com/rustless/valico)
166
-
167
- ### Swift ###
168
-
169
- * [JSONSchema](https://github.com/kylef/JSONSchema.swift)
170
-
171
- If you use it as well, please fork and send a pull request adding yourself to
172
- the list :).
173
-
174
- Contributing
175
- ------------
176
-
177
- If you see something missing or incorrect, a pull request is most welcome!
178
-
179
- There are some sanity checks in place for testing the test suite. You can run
180
- them with `bin/jsonschema_suite check && npm test` or `tox && npm test`. They will be run automatically by
181
- [Travis CI](https://travis-ci.org/) as well.
@@ -1,298 +0,0 @@
1
- #! /usr/bin/env python3
2
- from __future__ import print_function
3
- from pprint import pformat
4
- import argparse
5
- import errno
6
- import fnmatch
7
- import json
8
- import os
9
- import random
10
- import shutil
11
- import sys
12
- import textwrap
13
- import unittest
14
- import warnings
15
-
16
- if getattr(unittest, "skipIf", None) is None:
17
- unittest.skipIf = lambda cond, msg : lambda fn : fn
18
-
19
- try:
20
- import jsonschema
21
- except ImportError:
22
- jsonschema = None
23
- else:
24
- validators = getattr(
25
- jsonschema.validators, "validators", jsonschema.validators
26
- )
27
-
28
-
29
- ROOT_DIR = os.path.abspath(
30
- os.path.join(os.path.dirname(__file__), os.pardir).rstrip("__pycache__"),
31
- )
32
- SUITE_ROOT_DIR = os.path.join(ROOT_DIR, "tests")
33
-
34
- REMOTES = {
35
- "integer.json": {u"type": u"integer"},
36
- "name.json": {
37
- u"type": "string",
38
- u"definitions": {
39
- u"orNull": {u"anyOf": [{u"type": u"null"}, {u"$ref": u"#"}]},
40
- },
41
- },
42
- "name-defs.json": {
43
- u"type": "string",
44
- u"$defs": {
45
- u"orNull": {u"anyOf": [{u"type": u"null"}, {u"$ref": u"#"}]},
46
- },
47
- },
48
- "subSchemas.json": {
49
- u"integer": {u"type": u"integer"},
50
- u"refToInteger": {u"$ref": u"#/integer"},
51
- },
52
- "folder/folderInteger.json": {u"type": u"integer"}
53
- }
54
- REMOTES_DIR = os.path.join(ROOT_DIR, "remotes")
55
-
56
- with open(os.path.join(ROOT_DIR, "test-schema.json")) as schema:
57
- TESTSUITE_SCHEMA = json.load(schema)
58
-
59
- def files(paths):
60
- for path in paths:
61
- with open(path) as test_file:
62
- yield json.load(test_file)
63
-
64
-
65
- def groups(paths):
66
- for test_file in files(paths):
67
- for group in test_file:
68
- yield group
69
-
70
-
71
- def cases(paths):
72
- for test_group in groups(paths):
73
- for test in test_group["tests"]:
74
- test["schema"] = test_group["schema"]
75
- yield test
76
-
77
-
78
- def collect(root_dir):
79
- for root, dirs, files in os.walk(root_dir):
80
- for filename in fnmatch.filter(files, "*.json"):
81
- yield os.path.join(root, filename)
82
-
83
-
84
- class SanityTests(unittest.TestCase):
85
- @classmethod
86
- def setUpClass(cls):
87
- print("Looking for tests in %s" % SUITE_ROOT_DIR)
88
- cls.test_files = list(collect(SUITE_ROOT_DIR))
89
- print("Found %s test files" % len(cls.test_files))
90
- assert cls.test_files, "Didn't find the test files!"
91
-
92
- def test_all_files_are_valid_json(self):
93
- for path in self.test_files:
94
- with open(path) as test_file:
95
- try:
96
- json.load(test_file)
97
- except ValueError as error:
98
- self.fail("%s contains invalid JSON (%s)" % (path, error))
99
-
100
- def test_all_descriptions_have_reasonable_length(self):
101
- for case in cases(self.test_files):
102
- description = case["description"]
103
- self.assertLess(
104
- len(description),
105
- 70,
106
- "%r is too long! (keep it to less than 70 chars)" % (
107
- description,
108
- ),
109
- )
110
-
111
- def test_all_descriptions_are_unique(self):
112
- for group in groups(self.test_files):
113
- descriptions = set(test["description"] for test in group["tests"])
114
- self.assertEqual(
115
- len(descriptions),
116
- len(group["tests"]),
117
- "%r contains a duplicate description" % (group,)
118
- )
119
-
120
- @unittest.skipIf(jsonschema is None, "Validation library not present!")
121
- def test_all_schemas_are_valid(self):
122
- for schema in os.listdir(SUITE_ROOT_DIR):
123
- schema_validator = validators.get(schema)
124
- if schema_validator is not None:
125
- test_files = collect(os.path.join(SUITE_ROOT_DIR, schema))
126
- for case in cases(test_files):
127
- try:
128
- schema_validator.check_schema(case["schema"])
129
- except jsonschema.SchemaError as error:
130
- self.fail("%s contains an invalid schema (%s)" %
131
- (case, error))
132
- else:
133
- warnings.warn("No schema validator for %s" % schema)
134
-
135
- @unittest.skipIf(jsonschema is None, "Validation library not present!")
136
- def test_suites_are_valid(self):
137
- validator = jsonschema.Draft4Validator(TESTSUITE_SCHEMA)
138
- for tests in files(self.test_files):
139
- try:
140
- validator.validate(tests)
141
- except jsonschema.ValidationError as error:
142
- self.fail(str(error))
143
-
144
- def test_remote_schemas_are_updated(self):
145
- files = {}
146
- for parent, _, paths in os.walk(REMOTES_DIR):
147
- for path in paths:
148
- absolute_path = os.path.join(parent, path)
149
- with open(absolute_path) as schema_file:
150
- files[absolute_path] = json.load(schema_file)
151
-
152
- expected = {
153
- os.path.join(REMOTES_DIR, path): contents
154
- for path, contents in REMOTES.items()
155
- }
156
-
157
- missing = set(files).symmetric_difference(expected)
158
- changed = {
159
- path
160
- for path, contents in expected.items()
161
- if path in files
162
- and contents != files[path]
163
- }
164
-
165
- self.assertEqual(
166
- files,
167
- expected,
168
- msg=textwrap.dedent(
169
- """
170
- Remotes in the remotes/ directory do not match those in the
171
- ``jsonschema_suite`` Python script.
172
-
173
- Unfortunately for the minute, each remote file is duplicated in
174
- two places.""" + ("""
175
-
176
- Only present in one location:
177
-
178
- {}""".format("\n".join(missing)) if missing else "") + ("""
179
-
180
- Conflicting between the two:
181
-
182
- {}""".format("\n".join(changed)) if changed else "")
183
- )
184
- )
185
-
186
-
187
- def main(arguments):
188
- if arguments.command == "check":
189
- suite = unittest.TestLoader().loadTestsFromTestCase(SanityTests)
190
- result = unittest.TextTestRunner(verbosity=2).run(suite)
191
- sys.exit(not result.wasSuccessful())
192
- elif arguments.command == "flatten":
193
- selected_cases = [case for case in cases(collect(arguments.version))]
194
-
195
- if arguments.randomize:
196
- random.shuffle(selected_cases)
197
-
198
- json.dump(selected_cases, sys.stdout, indent=4, sort_keys=True)
199
- elif arguments.command == "remotes":
200
- json.dump(REMOTES, sys.stdout, indent=4, sort_keys=True)
201
- elif arguments.command == "dump_remotes":
202
- if arguments.update:
203
- shutil.rmtree(arguments.out_dir, ignore_errors=True)
204
-
205
- try:
206
- os.makedirs(arguments.out_dir)
207
- except OSError as e:
208
- if e.errno == errno.EEXIST:
209
- print("%s already exists. Aborting." % arguments.out_dir)
210
- sys.exit(1)
211
- raise
212
-
213
- for url, schema in REMOTES.items():
214
- filepath = os.path.join(arguments.out_dir, url)
215
-
216
- try:
217
- os.makedirs(os.path.dirname(filepath))
218
- except OSError as e:
219
- if e.errno != errno.EEXIST:
220
- raise
221
-
222
- with open(filepath, "w") as out_file:
223
- json.dump(schema, out_file, indent=4, sort_keys=True)
224
- out_file.write("\n")
225
- elif arguments.command == "serve":
226
- try:
227
- from flask import Flask, jsonify
228
- except ImportError:
229
- print(textwrap.dedent("""
230
- The Flask library is required to serve the remote schemas.
231
-
232
- You can install it by running `pip install Flask`.
233
-
234
- Alternatively, see the `jsonschema_suite remotes` or
235
- `jsonschema_suite dump_remotes` commands to create static files
236
- that can be served with your own web server.
237
- """.strip("\n")))
238
- sys.exit(1)
239
-
240
- app = Flask(__name__)
241
-
242
- @app.route("/<path:path>")
243
- def serve_path(path):
244
- if path in REMOTES:
245
- return jsonify(REMOTES[path])
246
- return "Document does not exist.", 404
247
-
248
- app.run(port=1234)
249
-
250
-
251
- parser = argparse.ArgumentParser(
252
- description="JSON Schema Test Suite utilities",
253
- )
254
- subparsers = parser.add_subparsers(help="utility commands", dest="command")
255
-
256
- check = subparsers.add_parser("check", help="Sanity check the test suite.")
257
-
258
- flatten = subparsers.add_parser(
259
- "flatten",
260
- help="Output a flattened file containing a selected version's test cases."
261
- )
262
- flatten.add_argument(
263
- "--randomize",
264
- action="store_true",
265
- help="Randomize the order of the outputted cases.",
266
- )
267
- flatten.add_argument(
268
- "version", help="The directory containing the version to output",
269
- )
270
-
271
- remotes = subparsers.add_parser(
272
- "remotes",
273
- help="Output the expected URLs and their associated schemas for remote "
274
- "ref tests as a JSON object."
275
- )
276
-
277
- dump_remotes = subparsers.add_parser(
278
- "dump_remotes", help="Dump the remote ref schemas into a file tree",
279
- )
280
- dump_remotes.add_argument(
281
- "--update",
282
- action="store_true",
283
- help="Update the remotes in an existing directory.",
284
- )
285
- dump_remotes.add_argument(
286
- "--out-dir",
287
- default=REMOTES_DIR,
288
- type=os.path.abspath,
289
- help="The output directory to create as the root of the file tree",
290
- )
291
-
292
- serve = subparsers.add_parser(
293
- "serve",
294
- help="Start a webserver to serve schemas used by remote ref tests."
295
- )
296
-
297
- if __name__ == "__main__":
298
- main(parser.parse_args())