json_schemer 0.2.8 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/json_schemer.gemspec +2 -2
  4. data/lib/json_schemer/schema/base.rb +52 -32
  5. data/lib/json_schemer/version.rb +1 -1
  6. data/lib/json_schemer.rb +1 -0
  7. metadata +4 -234
  8. data/JSON-Schema-Test-Suite/.gitignore +0 -1
  9. data/JSON-Schema-Test-Suite/.travis.yml +0 -8
  10. data/JSON-Schema-Test-Suite/LICENSE +0 -19
  11. data/JSON-Schema-Test-Suite/README.md +0 -181
  12. data/JSON-Schema-Test-Suite/bin/jsonschema_suite +0 -298
  13. data/JSON-Schema-Test-Suite/index.js +0 -45
  14. data/JSON-Schema-Test-Suite/package.json +0 -28
  15. data/JSON-Schema-Test-Suite/remotes/folder/folderInteger.json +0 -3
  16. data/JSON-Schema-Test-Suite/remotes/integer.json +0 -3
  17. data/JSON-Schema-Test-Suite/remotes/name-defs.json +0 -15
  18. data/JSON-Schema-Test-Suite/remotes/name.json +0 -15
  19. data/JSON-Schema-Test-Suite/remotes/subSchemas.json +0 -8
  20. data/JSON-Schema-Test-Suite/test-schema.json +0 -59
  21. data/JSON-Schema-Test-Suite/tests/draft2019-09/additionalItems.json +0 -87
  22. data/JSON-Schema-Test-Suite/tests/draft2019-09/additionalProperties.json +0 -133
  23. data/JSON-Schema-Test-Suite/tests/draft2019-09/allOf.json +0 -218
  24. data/JSON-Schema-Test-Suite/tests/draft2019-09/anchor.json +0 -87
  25. data/JSON-Schema-Test-Suite/tests/draft2019-09/anyOf.json +0 -189
  26. data/JSON-Schema-Test-Suite/tests/draft2019-09/boolean_schema.json +0 -104
  27. data/JSON-Schema-Test-Suite/tests/draft2019-09/const.json +0 -170
  28. data/JSON-Schema-Test-Suite/tests/draft2019-09/contains.json +0 -95
  29. data/JSON-Schema-Test-Suite/tests/draft2019-09/default.json +0 -49
  30. data/JSON-Schema-Test-Suite/tests/draft2019-09/defs.json +0 -24
  31. data/JSON-Schema-Test-Suite/tests/draft2019-09/dependencies.json +0 -268
  32. data/JSON-Schema-Test-Suite/tests/draft2019-09/enum.json +0 -179
  33. data/JSON-Schema-Test-Suite/tests/draft2019-09/exclusiveMaximum.json +0 -30
  34. data/JSON-Schema-Test-Suite/tests/draft2019-09/exclusiveMinimum.json +0 -30
  35. data/JSON-Schema-Test-Suite/tests/draft2019-09/format.json +0 -614
  36. data/JSON-Schema-Test-Suite/tests/draft2019-09/if-then-else.json +0 -188
  37. data/JSON-Schema-Test-Suite/tests/draft2019-09/items.json +0 -250
  38. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxItems.json +0 -28
  39. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxLength.json +0 -33
  40. data/JSON-Schema-Test-Suite/tests/draft2019-09/maxProperties.json +0 -38
  41. data/JSON-Schema-Test-Suite/tests/draft2019-09/maximum.json +0 -28
  42. data/JSON-Schema-Test-Suite/tests/draft2019-09/minItems.json +0 -28
  43. data/JSON-Schema-Test-Suite/tests/draft2019-09/minLength.json +0 -33
  44. data/JSON-Schema-Test-Suite/tests/draft2019-09/minProperties.json +0 -38
  45. data/JSON-Schema-Test-Suite/tests/draft2019-09/minimum.json +0 -59
  46. data/JSON-Schema-Test-Suite/tests/draft2019-09/multipleOf.json +0 -60
  47. data/JSON-Schema-Test-Suite/tests/draft2019-09/not.json +0 -117
  48. data/JSON-Schema-Test-Suite/tests/draft2019-09/oneOf.json +0 -206
  49. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/bignum.json +0 -105
  50. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/content.json +0 -77
  51. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/ecmascript-regex.json +0 -213
  52. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/date-time.json +0 -53
  53. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/date.json +0 -23
  54. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/email.json +0 -18
  55. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/hostname.json +0 -33
  56. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/idn-email.json +0 -18
  57. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/idn-hostname.json +0 -28
  58. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/ipv4.json +0 -33
  59. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/ipv6.json +0 -28
  60. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/iri-reference.json +0 -43
  61. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/iri.json +0 -53
  62. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/json-pointer.json +0 -168
  63. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/regex.json +0 -18
  64. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/relative-json-pointer.json +0 -33
  65. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/time.json +0 -23
  66. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri-reference.json +0 -43
  67. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri-template.json +0 -28
  68. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/format/uri.json +0 -103
  69. data/JSON-Schema-Test-Suite/tests/draft2019-09/optional/zeroTerminatedFloats.json +0 -15
  70. data/JSON-Schema-Test-Suite/tests/draft2019-09/pattern.json +0 -34
  71. data/JSON-Schema-Test-Suite/tests/draft2019-09/patternProperties.json +0 -151
  72. data/JSON-Schema-Test-Suite/tests/draft2019-09/properties.json +0 -167
  73. data/JSON-Schema-Test-Suite/tests/draft2019-09/propertyNames.json +0 -78
  74. data/JSON-Schema-Test-Suite/tests/draft2019-09/ref.json +0 -359
  75. data/JSON-Schema-Test-Suite/tests/draft2019-09/refRemote.json +0 -167
  76. data/JSON-Schema-Test-Suite/tests/draft2019-09/required.json +0 -105
  77. data/JSON-Schema-Test-Suite/tests/draft2019-09/type.json +0 -464
  78. data/JSON-Schema-Test-Suite/tests/draft2019-09/uniqueItems.json +0 -173
  79. data/JSON-Schema-Test-Suite/tests/draft3/additionalItems.json +0 -82
  80. data/JSON-Schema-Test-Suite/tests/draft3/additionalProperties.json +0 -133
  81. data/JSON-Schema-Test-Suite/tests/draft3/default.json +0 -49
  82. data/JSON-Schema-Test-Suite/tests/draft3/dependencies.json +0 -118
  83. data/JSON-Schema-Test-Suite/tests/draft3/disallow.json +0 -80
  84. data/JSON-Schema-Test-Suite/tests/draft3/divisibleBy.json +0 -60
  85. data/JSON-Schema-Test-Suite/tests/draft3/enum.json +0 -71
  86. data/JSON-Schema-Test-Suite/tests/draft3/extends.json +0 -94
  87. data/JSON-Schema-Test-Suite/tests/draft3/format.json +0 -362
  88. data/JSON-Schema-Test-Suite/tests/draft3/items.json +0 -46
  89. data/JSON-Schema-Test-Suite/tests/draft3/maxItems.json +0 -28
  90. data/JSON-Schema-Test-Suite/tests/draft3/maxLength.json +0 -33
  91. data/JSON-Schema-Test-Suite/tests/draft3/maximum.json +0 -42
  92. data/JSON-Schema-Test-Suite/tests/draft3/minItems.json +0 -28
  93. data/JSON-Schema-Test-Suite/tests/draft3/minLength.json +0 -33
  94. data/JSON-Schema-Test-Suite/tests/draft3/minimum.json +0 -73
  95. data/JSON-Schema-Test-Suite/tests/draft3/optional/bignum.json +0 -107
  96. data/JSON-Schema-Test-Suite/tests/draft3/optional/ecmascript-regex.json +0 -18
  97. data/JSON-Schema-Test-Suite/tests/draft3/optional/format.json +0 -227
  98. data/JSON-Schema-Test-Suite/tests/draft3/optional/zeroTerminatedFloats.json +0 -15
  99. data/JSON-Schema-Test-Suite/tests/draft3/pattern.json +0 -34
  100. data/JSON-Schema-Test-Suite/tests/draft3/patternProperties.json +0 -115
  101. data/JSON-Schema-Test-Suite/tests/draft3/properties.json +0 -97
  102. data/JSON-Schema-Test-Suite/tests/draft3/ref.json +0 -192
  103. data/JSON-Schema-Test-Suite/tests/draft3/refRemote.json +0 -74
  104. data/JSON-Schema-Test-Suite/tests/draft3/required.json +0 -53
  105. data/JSON-Schema-Test-Suite/tests/draft3/type.json +0 -489
  106. data/JSON-Schema-Test-Suite/tests/draft3/uniqueItems.json +0 -163
  107. data/JSON-Schema-Test-Suite/tests/draft4/additionalItems.json +0 -87
  108. data/JSON-Schema-Test-Suite/tests/draft4/additionalProperties.json +0 -133
  109. data/JSON-Schema-Test-Suite/tests/draft4/allOf.json +0 -185
  110. data/JSON-Schema-Test-Suite/tests/draft4/anyOf.json +0 -156
  111. data/JSON-Schema-Test-Suite/tests/draft4/default.json +0 -49
  112. data/JSON-Schema-Test-Suite/tests/draft4/definitions.json +0 -32
  113. data/JSON-Schema-Test-Suite/tests/draft4/dependencies.json +0 -194
  114. data/JSON-Schema-Test-Suite/tests/draft4/enum.json +0 -179
  115. data/JSON-Schema-Test-Suite/tests/draft4/format.json +0 -218
  116. data/JSON-Schema-Test-Suite/tests/draft4/items.json +0 -195
  117. data/JSON-Schema-Test-Suite/tests/draft4/maxItems.json +0 -28
  118. data/JSON-Schema-Test-Suite/tests/draft4/maxLength.json +0 -33
  119. data/JSON-Schema-Test-Suite/tests/draft4/maxProperties.json +0 -38
  120. data/JSON-Schema-Test-Suite/tests/draft4/maximum.json +0 -73
  121. data/JSON-Schema-Test-Suite/tests/draft4/minItems.json +0 -28
  122. data/JSON-Schema-Test-Suite/tests/draft4/minLength.json +0 -33
  123. data/JSON-Schema-Test-Suite/tests/draft4/minProperties.json +0 -38
  124. data/JSON-Schema-Test-Suite/tests/draft4/minimum.json +0 -104
  125. data/JSON-Schema-Test-Suite/tests/draft4/multipleOf.json +0 -60
  126. data/JSON-Schema-Test-Suite/tests/draft4/not.json +0 -96
  127. data/JSON-Schema-Test-Suite/tests/draft4/oneOf.json +0 -162
  128. data/JSON-Schema-Test-Suite/tests/draft4/optional/bignum.json +0 -107
  129. data/JSON-Schema-Test-Suite/tests/draft4/optional/ecmascript-regex.json +0 -213
  130. data/JSON-Schema-Test-Suite/tests/draft4/optional/format.json +0 -253
  131. data/JSON-Schema-Test-Suite/tests/draft4/optional/zeroTerminatedFloats.json +0 -15
  132. data/JSON-Schema-Test-Suite/tests/draft4/pattern.json +0 -34
  133. data/JSON-Schema-Test-Suite/tests/draft4/patternProperties.json +0 -120
  134. data/JSON-Schema-Test-Suite/tests/draft4/properties.json +0 -136
  135. data/JSON-Schema-Test-Suite/tests/draft4/ref.json +0 -411
  136. data/JSON-Schema-Test-Suite/tests/draft4/refRemote.json +0 -171
  137. data/JSON-Schema-Test-Suite/tests/draft4/required.json +0 -89
  138. data/JSON-Schema-Test-Suite/tests/draft4/type.json +0 -464
  139. data/JSON-Schema-Test-Suite/tests/draft4/uniqueItems.json +0 -173
  140. data/JSON-Schema-Test-Suite/tests/draft6/additionalItems.json +0 -87
  141. data/JSON-Schema-Test-Suite/tests/draft6/additionalProperties.json +0 -133
  142. data/JSON-Schema-Test-Suite/tests/draft6/allOf.json +0 -218
  143. data/JSON-Schema-Test-Suite/tests/draft6/anyOf.json +0 -189
  144. data/JSON-Schema-Test-Suite/tests/draft6/boolean_schema.json +0 -104
  145. data/JSON-Schema-Test-Suite/tests/draft6/const.json +0 -170
  146. data/JSON-Schema-Test-Suite/tests/draft6/contains.json +0 -100
  147. data/JSON-Schema-Test-Suite/tests/draft6/default.json +0 -49
  148. data/JSON-Schema-Test-Suite/tests/draft6/definitions.json +0 -32
  149. data/JSON-Schema-Test-Suite/tests/draft6/dependencies.json +0 -268
  150. data/JSON-Schema-Test-Suite/tests/draft6/enum.json +0 -179
  151. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMaximum.json +0 -30
  152. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMinimum.json +0 -30
  153. data/JSON-Schema-Test-Suite/tests/draft6/format.json +0 -326
  154. data/JSON-Schema-Test-Suite/tests/draft6/items.json +0 -250
  155. data/JSON-Schema-Test-Suite/tests/draft6/maxItems.json +0 -28
  156. data/JSON-Schema-Test-Suite/tests/draft6/maxLength.json +0 -33
  157. data/JSON-Schema-Test-Suite/tests/draft6/maxProperties.json +0 -38
  158. data/JSON-Schema-Test-Suite/tests/draft6/maximum.json +0 -28
  159. data/JSON-Schema-Test-Suite/tests/draft6/minItems.json +0 -28
  160. data/JSON-Schema-Test-Suite/tests/draft6/minLength.json +0 -33
  161. data/JSON-Schema-Test-Suite/tests/draft6/minProperties.json +0 -38
  162. data/JSON-Schema-Test-Suite/tests/draft6/minimum.json +0 -59
  163. data/JSON-Schema-Test-Suite/tests/draft6/multipleOf.json +0 -60
  164. data/JSON-Schema-Test-Suite/tests/draft6/not.json +0 -117
  165. data/JSON-Schema-Test-Suite/tests/draft6/oneOf.json +0 -206
  166. data/JSON-Schema-Test-Suite/tests/draft6/optional/bignum.json +0 -105
  167. data/JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json +0 -213
  168. data/JSON-Schema-Test-Suite/tests/draft6/optional/format.json +0 -491
  169. data/JSON-Schema-Test-Suite/tests/draft6/optional/zeroTerminatedFloats.json +0 -15
  170. data/JSON-Schema-Test-Suite/tests/draft6/pattern.json +0 -34
  171. data/JSON-Schema-Test-Suite/tests/draft6/patternProperties.json +0 -151
  172. data/JSON-Schema-Test-Suite/tests/draft6/properties.json +0 -167
  173. data/JSON-Schema-Test-Suite/tests/draft6/propertyNames.json +0 -78
  174. data/JSON-Schema-Test-Suite/tests/draft6/ref.json +0 -443
  175. data/JSON-Schema-Test-Suite/tests/draft6/refRemote.json +0 -171
  176. data/JSON-Schema-Test-Suite/tests/draft6/required.json +0 -105
  177. data/JSON-Schema-Test-Suite/tests/draft6/type.json +0 -464
  178. data/JSON-Schema-Test-Suite/tests/draft6/uniqueItems.json +0 -173
  179. data/JSON-Schema-Test-Suite/tests/draft7/additionalItems.json +0 -87
  180. data/JSON-Schema-Test-Suite/tests/draft7/additionalProperties.json +0 -133
  181. data/JSON-Schema-Test-Suite/tests/draft7/allOf.json +0 -218
  182. data/JSON-Schema-Test-Suite/tests/draft7/anyOf.json +0 -189
  183. data/JSON-Schema-Test-Suite/tests/draft7/boolean_schema.json +0 -104
  184. data/JSON-Schema-Test-Suite/tests/draft7/const.json +0 -170
  185. data/JSON-Schema-Test-Suite/tests/draft7/contains.json +0 -100
  186. data/JSON-Schema-Test-Suite/tests/draft7/default.json +0 -49
  187. data/JSON-Schema-Test-Suite/tests/draft7/definitions.json +0 -32
  188. data/JSON-Schema-Test-Suite/tests/draft7/dependencies.json +0 -268
  189. data/JSON-Schema-Test-Suite/tests/draft7/enum.json +0 -179
  190. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMaximum.json +0 -30
  191. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMinimum.json +0 -30
  192. data/JSON-Schema-Test-Suite/tests/draft7/format.json +0 -614
  193. data/JSON-Schema-Test-Suite/tests/draft7/if-then-else.json +0 -188
  194. data/JSON-Schema-Test-Suite/tests/draft7/items.json +0 -250
  195. data/JSON-Schema-Test-Suite/tests/draft7/maxItems.json +0 -28
  196. data/JSON-Schema-Test-Suite/tests/draft7/maxLength.json +0 -33
  197. data/JSON-Schema-Test-Suite/tests/draft7/maxProperties.json +0 -38
  198. data/JSON-Schema-Test-Suite/tests/draft7/maximum.json +0 -28
  199. data/JSON-Schema-Test-Suite/tests/draft7/minItems.json +0 -28
  200. data/JSON-Schema-Test-Suite/tests/draft7/minLength.json +0 -33
  201. data/JSON-Schema-Test-Suite/tests/draft7/minProperties.json +0 -38
  202. data/JSON-Schema-Test-Suite/tests/draft7/minimum.json +0 -59
  203. data/JSON-Schema-Test-Suite/tests/draft7/multipleOf.json +0 -60
  204. data/JSON-Schema-Test-Suite/tests/draft7/not.json +0 -117
  205. data/JSON-Schema-Test-Suite/tests/draft7/oneOf.json +0 -206
  206. data/JSON-Schema-Test-Suite/tests/draft7/optional/bignum.json +0 -105
  207. data/JSON-Schema-Test-Suite/tests/draft7/optional/content.json +0 -77
  208. data/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json +0 -213
  209. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date-time.json +0 -53
  210. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date.json +0 -23
  211. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/email.json +0 -18
  212. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/hostname.json +0 -33
  213. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-email.json +0 -18
  214. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-hostname.json +0 -28
  215. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv4.json +0 -33
  216. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv6.json +0 -28
  217. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri-reference.json +0 -43
  218. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri.json +0 -53
  219. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/json-pointer.json +0 -168
  220. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/regex.json +0 -18
  221. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/relative-json-pointer.json +0 -33
  222. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/time.json +0 -23
  223. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-reference.json +0 -43
  224. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-template.json +0 -28
  225. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri.json +0 -103
  226. data/JSON-Schema-Test-Suite/tests/draft7/optional/zeroTerminatedFloats.json +0 -15
  227. data/JSON-Schema-Test-Suite/tests/draft7/pattern.json +0 -34
  228. data/JSON-Schema-Test-Suite/tests/draft7/patternProperties.json +0 -151
  229. data/JSON-Schema-Test-Suite/tests/draft7/properties.json +0 -167
  230. data/JSON-Schema-Test-Suite/tests/draft7/propertyNames.json +0 -78
  231. data/JSON-Schema-Test-Suite/tests/draft7/ref.json +0 -443
  232. data/JSON-Schema-Test-Suite/tests/draft7/refRemote.json +0 -171
  233. data/JSON-Schema-Test-Suite/tests/draft7/required.json +0 -105
  234. data/JSON-Schema-Test-Suite/tests/draft7/type.json +0 -464
  235. data/JSON-Schema-Test-Suite/tests/draft7/uniqueItems.json +0 -173
  236. data/JSON-Schema-Test-Suite/tests/latest +0 -1
  237. data/JSON-Schema-Test-Suite/tox.ini +0 -9
@@ -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())
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- const Ajv = require('ajv');
4
- const jsonSchemaTest = require('json-schema-test');
5
- const assert = require('assert');
6
-
7
- const refs = {
8
- 'http://localhost:1234/integer.json': require('./remotes/integer.json'),
9
- 'http://localhost:1234/subSchemas.json': require('./remotes/subSchemas.json'),
10
- 'http://localhost:1234/folder/folderInteger.json': require('./remotes/folder/folderInteger.json'),
11
- 'http://localhost:1234/name.json': require('./remotes/name.json'),
12
- 'http://localhost:1234/name-defs.json': require('./remotes/name-defs.json')
13
- };
14
-
15
- const SKIP = {
16
- 4: ['optional/zeroTerminatedFloats'],
17
- 7: [
18
- 'format/idn-email',
19
- 'format/idn-hostname',
20
- 'format/iri',
21
- 'format/iri-reference',
22
- 'optional/content'
23
- ]
24
- };
25
-
26
- [4, 6, 7].forEach((draft) => {
27
- let ajv;
28
- if (draft == 7) {
29
- ajv = new Ajv({format: 'full'});
30
- } else {
31
- const schemaId = draft == 4 ? 'id' : '$id';
32
- ajv = new Ajv({format: 'full', meta: false, schemaId});
33
- ajv.addMetaSchema(require(`ajv/lib/refs/json-schema-draft-0${draft}.json`));
34
- ajv._opts.defaultMeta = `http://json-schema.org/draft-0${draft}/schema#`;
35
- }
36
- for (const uri in refs) ajv.addSchema(refs[uri], uri);
37
-
38
- jsonSchemaTest(ajv, {
39
- description: `Test suite draft-0${draft}`,
40
- suites: {tests: `./tests/draft${draft}/{**/,}*.json`},
41
- skip: SKIP[draft],
42
- cwd: __dirname,
43
- hideFolder: 'tests/'
44
- });
45
- });
@@ -1,28 +0,0 @@
1
- {
2
- "name": "json-schema-test-suite",
3
- "version": "0.1.0",
4
- "description": "A language agnostic test suite for the JSON Schema specifications",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "mocha index.js -R spec"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite.git"
12
- },
13
- "keywords": [
14
- "json-schema",
15
- "tests"
16
- ],
17
- "author": "http://json-schema.org",
18
- "license": "MIT",
19
- "bugs": {
20
- "url": "https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues"
21
- },
22
- "homepage": "https://github.com/json-schema-org/JSON-Schema-Test-Suite#readme",
23
- "devDependencies": {
24
- "ajv": "^6.0.0-rc.1",
25
- "json-schema-test": "^2.0.0",
26
- "mocha": "^3.2.0"
27
- }
28
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "integer"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "integer"
3
- }
@@ -1,15 +0,0 @@
1
- {
2
- "$defs": {
3
- "orNull": {
4
- "anyOf": [
5
- {
6
- "type": "null"
7
- },
8
- {
9
- "$ref": "#"
10
- }
11
- ]
12
- }
13
- },
14
- "type": "string"
15
- }
@@ -1,15 +0,0 @@
1
- {
2
- "definitions": {
3
- "orNull": {
4
- "anyOf": [
5
- {
6
- "type": "null"
7
- },
8
- {
9
- "$ref": "#"
10
- }
11
- ]
12
- }
13
- },
14
- "type": "string"
15
- }
@@ -1,8 +0,0 @@
1
- {
2
- "integer": {
3
- "type": "integer"
4
- },
5
- "refToInteger": {
6
- "$ref": "#/integer"
7
- }
8
- }
@@ -1,59 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "definitions": {
4
- "outputItem": {
5
- "type": "object",
6
- "properties": {
7
- "valid": {"type": "boolean"},
8
- "keywordLocation": {"type": "string"},
9
- "absoluteKeywordLocation": {
10
- "type": "string",
11
- "format": "uri"
12
- },
13
- "instanceLocation": {"type": "string"},
14
- "annotations": {
15
- "type": "array",
16
- "items": {"$ref": "#/definitions/outputItem"}
17
- },
18
- "errors": {
19
- "type": "array",
20
- "items": {"$ref": "#/definitions/outputItem"}
21
- }
22
- }
23
- }
24
- },
25
- "type": "array",
26
- "items": {
27
- "type": "object",
28
- "required": ["description", "schema", "tests"],
29
- "properties": {
30
- "description": {"type": "string"},
31
- "schema": {},
32
- "tests": {
33
- "type": "array",
34
- "items": {
35
- "type": "object",
36
- "required": ["description", "data", "valid"],
37
- "properties": {
38
- "description": {"type": "string"},
39
- "data": {},
40
- "valid": {"type": "boolean"},
41
- "output": {
42
- "type": "object",
43
- "properties": {
44
- "basic": {"$ref": "#/definitions/outputItem"},
45
- "detailed": {"$ref": "#/definitions/outputItem"},
46
- "verbose": {"$ref": "#/definitions/outputItem"}
47
- },
48
- "required": ["basic", "detailed", "verbose"]
49
- }
50
- },
51
- "additionalProperties": false
52
- },
53
- "minItems": 1
54
- }
55
- },
56
- "additionalProperties": false,
57
- "minItems": 1
58
- }
59
- }