json_schemer 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/JSON-Schema-Test-Suite/.gitignore +1 -0
  5. data/JSON-Schema-Test-Suite/.travis.yml +8 -0
  6. data/JSON-Schema-Test-Suite/LICENSE +19 -0
  7. data/JSON-Schema-Test-Suite/README.md +181 -0
  8. data/JSON-Schema-Test-Suite/bin/jsonschema_suite +295 -0
  9. data/JSON-Schema-Test-Suite/index.js +45 -0
  10. data/JSON-Schema-Test-Suite/package.json +28 -0
  11. data/JSON-Schema-Test-Suite/remotes/folder/folderInteger.json +3 -0
  12. data/JSON-Schema-Test-Suite/remotes/integer.json +3 -0
  13. data/JSON-Schema-Test-Suite/remotes/name-defs.json +11 -0
  14. data/JSON-Schema-Test-Suite/remotes/name.json +11 -0
  15. data/JSON-Schema-Test-Suite/remotes/subSchemas.json +8 -0
  16. data/JSON-Schema-Test-Suite/test-schema.json +59 -0
  17. data/JSON-Schema-Test-Suite/tests/draft2019-08/additionalItems.json +87 -0
  18. data/JSON-Schema-Test-Suite/tests/draft2019-08/additionalProperties.json +133 -0
  19. data/JSON-Schema-Test-Suite/tests/draft2019-08/allOf.json +218 -0
  20. data/JSON-Schema-Test-Suite/tests/draft2019-08/anyOf.json +189 -0
  21. data/JSON-Schema-Test-Suite/tests/draft2019-08/boolean_schema.json +104 -0
  22. data/JSON-Schema-Test-Suite/tests/draft2019-08/const.json +170 -0
  23. data/JSON-Schema-Test-Suite/tests/draft2019-08/contains.json +95 -0
  24. data/JSON-Schema-Test-Suite/tests/draft2019-08/default.json +49 -0
  25. data/JSON-Schema-Test-Suite/tests/draft2019-08/defs.json +24 -0
  26. data/JSON-Schema-Test-Suite/tests/draft2019-08/dependencies.json +268 -0
  27. data/JSON-Schema-Test-Suite/tests/draft2019-08/enum.json +179 -0
  28. data/JSON-Schema-Test-Suite/tests/draft2019-08/exclusiveMaximum.json +30 -0
  29. data/JSON-Schema-Test-Suite/tests/draft2019-08/exclusiveMinimum.json +30 -0
  30. data/JSON-Schema-Test-Suite/tests/draft2019-08/if-then-else.json +188 -0
  31. data/JSON-Schema-Test-Suite/tests/draft2019-08/items.json +250 -0
  32. data/JSON-Schema-Test-Suite/tests/draft2019-08/maxItems.json +28 -0
  33. data/JSON-Schema-Test-Suite/tests/draft2019-08/maxLength.json +33 -0
  34. data/JSON-Schema-Test-Suite/tests/draft2019-08/maxProperties.json +38 -0
  35. data/JSON-Schema-Test-Suite/tests/draft2019-08/maximum.json +28 -0
  36. data/JSON-Schema-Test-Suite/tests/draft2019-08/minItems.json +28 -0
  37. data/JSON-Schema-Test-Suite/tests/draft2019-08/minLength.json +33 -0
  38. data/JSON-Schema-Test-Suite/tests/draft2019-08/minProperties.json +38 -0
  39. data/JSON-Schema-Test-Suite/tests/draft2019-08/minimum.json +59 -0
  40. data/JSON-Schema-Test-Suite/tests/draft2019-08/multipleOf.json +60 -0
  41. data/JSON-Schema-Test-Suite/tests/draft2019-08/not.json +117 -0
  42. data/JSON-Schema-Test-Suite/tests/draft2019-08/oneOf.json +206 -0
  43. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/bignum.json +105 -0
  44. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/content.json +77 -0
  45. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/ecmascript-regex.json +13 -0
  46. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/date-time.json +53 -0
  47. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/date.json +23 -0
  48. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/email.json +18 -0
  49. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/hostname.json +33 -0
  50. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/idn-email.json +18 -0
  51. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/idn-hostname.json +28 -0
  52. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/ipv4.json +33 -0
  53. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/ipv6.json +28 -0
  54. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/iri-reference.json +43 -0
  55. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/iri.json +53 -0
  56. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/json-pointer.json +168 -0
  57. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/regex.json +18 -0
  58. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/relative-json-pointer.json +33 -0
  59. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/time.json +23 -0
  60. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/uri-reference.json +43 -0
  61. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/uri-template.json +28 -0
  62. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/format/uri.json +103 -0
  63. data/JSON-Schema-Test-Suite/tests/draft2019-08/optional/zeroTerminatedFloats.json +15 -0
  64. data/JSON-Schema-Test-Suite/tests/draft2019-08/pattern.json +34 -0
  65. data/JSON-Schema-Test-Suite/tests/draft2019-08/patternProperties.json +151 -0
  66. data/JSON-Schema-Test-Suite/tests/draft2019-08/properties.json +167 -0
  67. data/JSON-Schema-Test-Suite/tests/draft2019-08/propertyNames.json +78 -0
  68. data/JSON-Schema-Test-Suite/tests/draft2019-08/ref.json +443 -0
  69. data/JSON-Schema-Test-Suite/tests/draft2019-08/refRemote.json +167 -0
  70. data/JSON-Schema-Test-Suite/tests/draft2019-08/required.json +105 -0
  71. data/JSON-Schema-Test-Suite/tests/draft2019-08/type.json +464 -0
  72. data/JSON-Schema-Test-Suite/tests/draft2019-08/uniqueItems.json +89 -0
  73. data/JSON-Schema-Test-Suite/tests/draft3/additionalItems.json +82 -0
  74. data/JSON-Schema-Test-Suite/tests/draft3/additionalProperties.json +133 -0
  75. data/JSON-Schema-Test-Suite/tests/draft3/default.json +49 -0
  76. data/JSON-Schema-Test-Suite/tests/draft3/dependencies.json +118 -0
  77. data/JSON-Schema-Test-Suite/tests/draft3/disallow.json +80 -0
  78. data/JSON-Schema-Test-Suite/tests/draft3/divisibleBy.json +60 -0
  79. data/JSON-Schema-Test-Suite/tests/draft3/enum.json +71 -0
  80. data/JSON-Schema-Test-Suite/tests/draft3/extends.json +94 -0
  81. data/JSON-Schema-Test-Suite/tests/draft3/items.json +46 -0
  82. data/JSON-Schema-Test-Suite/tests/draft3/maxItems.json +28 -0
  83. data/JSON-Schema-Test-Suite/tests/draft3/maxLength.json +33 -0
  84. data/JSON-Schema-Test-Suite/tests/draft3/maximum.json +42 -0
  85. data/JSON-Schema-Test-Suite/tests/draft3/minItems.json +28 -0
  86. data/JSON-Schema-Test-Suite/tests/draft3/minLength.json +33 -0
  87. data/JSON-Schema-Test-Suite/tests/draft3/minimum.json +73 -0
  88. data/JSON-Schema-Test-Suite/tests/draft3/optional/bignum.json +107 -0
  89. data/JSON-Schema-Test-Suite/tests/draft3/optional/format.json +227 -0
  90. data/JSON-Schema-Test-Suite/tests/draft3/optional/jsregex.json +18 -0
  91. data/JSON-Schema-Test-Suite/tests/draft3/optional/zeroTerminatedFloats.json +15 -0
  92. data/JSON-Schema-Test-Suite/tests/draft3/pattern.json +34 -0
  93. data/JSON-Schema-Test-Suite/tests/draft3/patternProperties.json +115 -0
  94. data/JSON-Schema-Test-Suite/tests/draft3/properties.json +97 -0
  95. data/JSON-Schema-Test-Suite/tests/draft3/ref.json +192 -0
  96. data/JSON-Schema-Test-Suite/tests/draft3/refRemote.json +74 -0
  97. data/JSON-Schema-Test-Suite/tests/draft3/required.json +53 -0
  98. data/JSON-Schema-Test-Suite/tests/draft3/type.json +489 -0
  99. data/JSON-Schema-Test-Suite/tests/draft3/uniqueItems.json +79 -0
  100. data/JSON-Schema-Test-Suite/tests/draft4/additionalItems.json +87 -0
  101. data/JSON-Schema-Test-Suite/tests/draft4/additionalProperties.json +133 -0
  102. data/JSON-Schema-Test-Suite/tests/draft4/allOf.json +185 -0
  103. data/JSON-Schema-Test-Suite/tests/draft4/anyOf.json +156 -0
  104. data/JSON-Schema-Test-Suite/tests/draft4/default.json +49 -0
  105. data/JSON-Schema-Test-Suite/tests/draft4/definitions.json +32 -0
  106. data/JSON-Schema-Test-Suite/tests/draft4/dependencies.json +194 -0
  107. data/JSON-Schema-Test-Suite/tests/draft4/enum.json +179 -0
  108. data/JSON-Schema-Test-Suite/tests/draft4/items.json +195 -0
  109. data/JSON-Schema-Test-Suite/tests/draft4/maxItems.json +28 -0
  110. data/JSON-Schema-Test-Suite/tests/draft4/maxLength.json +33 -0
  111. data/JSON-Schema-Test-Suite/tests/draft4/maxProperties.json +38 -0
  112. data/JSON-Schema-Test-Suite/tests/draft4/maximum.json +73 -0
  113. data/JSON-Schema-Test-Suite/tests/draft4/minItems.json +28 -0
  114. data/JSON-Schema-Test-Suite/tests/draft4/minLength.json +33 -0
  115. data/JSON-Schema-Test-Suite/tests/draft4/minProperties.json +38 -0
  116. data/JSON-Schema-Test-Suite/tests/draft4/minimum.json +104 -0
  117. data/JSON-Schema-Test-Suite/tests/draft4/multipleOf.json +60 -0
  118. data/JSON-Schema-Test-Suite/tests/draft4/not.json +96 -0
  119. data/JSON-Schema-Test-Suite/tests/draft4/oneOf.json +162 -0
  120. data/JSON-Schema-Test-Suite/tests/draft4/optional/bignum.json +107 -0
  121. data/JSON-Schema-Test-Suite/tests/draft4/optional/ecmascript-regex.json +13 -0
  122. data/JSON-Schema-Test-Suite/tests/draft4/optional/format.json +253 -0
  123. data/JSON-Schema-Test-Suite/tests/draft4/optional/zeroTerminatedFloats.json +15 -0
  124. data/JSON-Schema-Test-Suite/tests/draft4/pattern.json +34 -0
  125. data/JSON-Schema-Test-Suite/tests/draft4/patternProperties.json +120 -0
  126. data/JSON-Schema-Test-Suite/tests/draft4/properties.json +136 -0
  127. data/JSON-Schema-Test-Suite/tests/draft4/ref.json +411 -0
  128. data/JSON-Schema-Test-Suite/tests/draft4/refRemote.json +171 -0
  129. data/JSON-Schema-Test-Suite/tests/draft4/required.json +89 -0
  130. data/JSON-Schema-Test-Suite/tests/draft4/type.json +464 -0
  131. data/JSON-Schema-Test-Suite/tests/draft4/uniqueItems.json +89 -0
  132. data/JSON-Schema-Test-Suite/tests/draft6/additionalItems.json +87 -0
  133. data/JSON-Schema-Test-Suite/tests/draft6/additionalProperties.json +133 -0
  134. data/JSON-Schema-Test-Suite/tests/draft6/allOf.json +218 -0
  135. data/JSON-Schema-Test-Suite/tests/draft6/anyOf.json +189 -0
  136. data/JSON-Schema-Test-Suite/tests/draft6/boolean_schema.json +104 -0
  137. data/JSON-Schema-Test-Suite/tests/draft6/const.json +170 -0
  138. data/JSON-Schema-Test-Suite/tests/draft6/contains.json +100 -0
  139. data/JSON-Schema-Test-Suite/tests/draft6/default.json +49 -0
  140. data/JSON-Schema-Test-Suite/tests/draft6/definitions.json +32 -0
  141. data/JSON-Schema-Test-Suite/tests/draft6/dependencies.json +268 -0
  142. data/JSON-Schema-Test-Suite/tests/draft6/enum.json +179 -0
  143. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMaximum.json +30 -0
  144. data/JSON-Schema-Test-Suite/tests/draft6/exclusiveMinimum.json +30 -0
  145. data/JSON-Schema-Test-Suite/tests/draft6/items.json +250 -0
  146. data/JSON-Schema-Test-Suite/tests/draft6/maxItems.json +28 -0
  147. data/JSON-Schema-Test-Suite/tests/draft6/maxLength.json +33 -0
  148. data/JSON-Schema-Test-Suite/tests/draft6/maxProperties.json +38 -0
  149. data/JSON-Schema-Test-Suite/tests/draft6/maximum.json +28 -0
  150. data/JSON-Schema-Test-Suite/tests/draft6/minItems.json +28 -0
  151. data/JSON-Schema-Test-Suite/tests/draft6/minLength.json +33 -0
  152. data/JSON-Schema-Test-Suite/tests/draft6/minProperties.json +38 -0
  153. data/JSON-Schema-Test-Suite/tests/draft6/minimum.json +59 -0
  154. data/JSON-Schema-Test-Suite/tests/draft6/multipleOf.json +60 -0
  155. data/JSON-Schema-Test-Suite/tests/draft6/not.json +117 -0
  156. data/JSON-Schema-Test-Suite/tests/draft6/oneOf.json +206 -0
  157. data/JSON-Schema-Test-Suite/tests/draft6/optional/bignum.json +105 -0
  158. data/JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json +13 -0
  159. data/JSON-Schema-Test-Suite/tests/draft6/optional/format.json +491 -0
  160. data/JSON-Schema-Test-Suite/tests/draft6/optional/zeroTerminatedFloats.json +15 -0
  161. data/JSON-Schema-Test-Suite/tests/draft6/pattern.json +34 -0
  162. data/JSON-Schema-Test-Suite/tests/draft6/patternProperties.json +151 -0
  163. data/JSON-Schema-Test-Suite/tests/draft6/properties.json +167 -0
  164. data/JSON-Schema-Test-Suite/tests/draft6/propertyNames.json +78 -0
  165. data/JSON-Schema-Test-Suite/tests/draft6/ref.json +443 -0
  166. data/JSON-Schema-Test-Suite/tests/draft6/refRemote.json +171 -0
  167. data/JSON-Schema-Test-Suite/tests/draft6/required.json +105 -0
  168. data/JSON-Schema-Test-Suite/tests/draft6/type.json +464 -0
  169. data/JSON-Schema-Test-Suite/tests/draft6/uniqueItems.json +89 -0
  170. data/JSON-Schema-Test-Suite/tests/draft7/additionalItems.json +87 -0
  171. data/JSON-Schema-Test-Suite/tests/draft7/additionalProperties.json +133 -0
  172. data/JSON-Schema-Test-Suite/tests/draft7/allOf.json +218 -0
  173. data/JSON-Schema-Test-Suite/tests/draft7/anyOf.json +189 -0
  174. data/JSON-Schema-Test-Suite/tests/draft7/boolean_schema.json +104 -0
  175. data/JSON-Schema-Test-Suite/tests/draft7/const.json +170 -0
  176. data/JSON-Schema-Test-Suite/tests/draft7/contains.json +100 -0
  177. data/JSON-Schema-Test-Suite/tests/draft7/default.json +49 -0
  178. data/JSON-Schema-Test-Suite/tests/draft7/definitions.json +32 -0
  179. data/JSON-Schema-Test-Suite/tests/draft7/dependencies.json +268 -0
  180. data/JSON-Schema-Test-Suite/tests/draft7/enum.json +179 -0
  181. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMaximum.json +30 -0
  182. data/JSON-Schema-Test-Suite/tests/draft7/exclusiveMinimum.json +30 -0
  183. data/JSON-Schema-Test-Suite/tests/draft7/if-then-else.json +188 -0
  184. data/JSON-Schema-Test-Suite/tests/draft7/items.json +250 -0
  185. data/JSON-Schema-Test-Suite/tests/draft7/maxItems.json +28 -0
  186. data/JSON-Schema-Test-Suite/tests/draft7/maxLength.json +33 -0
  187. data/JSON-Schema-Test-Suite/tests/draft7/maxProperties.json +38 -0
  188. data/JSON-Schema-Test-Suite/tests/draft7/maximum.json +28 -0
  189. data/JSON-Schema-Test-Suite/tests/draft7/minItems.json +28 -0
  190. data/JSON-Schema-Test-Suite/tests/draft7/minLength.json +33 -0
  191. data/JSON-Schema-Test-Suite/tests/draft7/minProperties.json +38 -0
  192. data/JSON-Schema-Test-Suite/tests/draft7/minimum.json +59 -0
  193. data/JSON-Schema-Test-Suite/tests/draft7/multipleOf.json +60 -0
  194. data/JSON-Schema-Test-Suite/tests/draft7/not.json +117 -0
  195. data/JSON-Schema-Test-Suite/tests/draft7/oneOf.json +206 -0
  196. data/JSON-Schema-Test-Suite/tests/draft7/optional/bignum.json +105 -0
  197. data/JSON-Schema-Test-Suite/tests/draft7/optional/content.json +77 -0
  198. data/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json +13 -0
  199. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date-time.json +53 -0
  200. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/date.json +23 -0
  201. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/email.json +18 -0
  202. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/hostname.json +33 -0
  203. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-email.json +18 -0
  204. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/idn-hostname.json +28 -0
  205. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv4.json +33 -0
  206. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/ipv6.json +28 -0
  207. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri-reference.json +43 -0
  208. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/iri.json +53 -0
  209. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/json-pointer.json +168 -0
  210. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/regex.json +18 -0
  211. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/relative-json-pointer.json +33 -0
  212. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/time.json +23 -0
  213. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-reference.json +43 -0
  214. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri-template.json +28 -0
  215. data/JSON-Schema-Test-Suite/tests/draft7/optional/format/uri.json +103 -0
  216. data/JSON-Schema-Test-Suite/tests/draft7/optional/zeroTerminatedFloats.json +15 -0
  217. data/JSON-Schema-Test-Suite/tests/draft7/pattern.json +34 -0
  218. data/JSON-Schema-Test-Suite/tests/draft7/patternProperties.json +151 -0
  219. data/JSON-Schema-Test-Suite/tests/draft7/properties.json +167 -0
  220. data/JSON-Schema-Test-Suite/tests/draft7/propertyNames.json +78 -0
  221. data/JSON-Schema-Test-Suite/tests/draft7/ref.json +443 -0
  222. data/JSON-Schema-Test-Suite/tests/draft7/refRemote.json +171 -0
  223. data/JSON-Schema-Test-Suite/tests/draft7/required.json +105 -0
  224. data/JSON-Schema-Test-Suite/tests/draft7/type.json +464 -0
  225. data/JSON-Schema-Test-Suite/tests/draft7/uniqueItems.json +89 -0
  226. data/JSON-Schema-Test-Suite/tox.ini +8 -0
  227. data/README.md +1 -1
  228. data/lib/json_schemer/schema/base.rb +2 -2
  229. data/lib/json_schemer/version.rb +1 -1
  230. metadata +226 -4
  231. data/.gitmodules +0 -4
  232. data/.travis.yml +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fb7d3d8b50f87d5e08647aedbbfc850e7c7378283923c41deb5ea42b69a38f8
4
- data.tar.gz: '09a4c42ee2ba22422c57d7c4591745931d0bd7d6455dfb0c2e377e9cf7521a0f'
3
+ metadata.gz: cc49528384df791b69a3ece8516d588f385761f64328d3738f4432e5acb05d99
4
+ data.tar.gz: 0a58ef039ec6d5236a0028bb1b4476c38763ea9d44a25f118a3aa3829ad559ef
5
5
  SHA512:
6
- metadata.gz: 146e560ae96d8f33640c51a1f6bc77e110ba45da5a41b08e0b5a139c65520680a65fc10e79e19cf204222bc8f1d0a1dadde5be6f4c9def1bba2d644ee4980795
7
- data.tar.gz: ec892824f0b350015dec49ed380df33247d9f1cd0d78a6a36488828f90adbf7f2f0232cd0f843b4a1e7d1e096738861127648f4a84378a3885cb1d3e16ae1dd7
6
+ metadata.gz: 689fc86d72801d49e2baae326fd2ff0e2e36a6e3a14379ba9f00ceae74618b4cfb445797b52f0d558ec7ad96c0d02797c6e52eb0938e82fa465eb94128a38b79
7
+ data.tar.gz: 68fff4ff624335455bec2d6273a81cbc9d995ffd94aa4e6cb82e5651375b2af9ea1a755e1c7e83aa87c2903f48cfd2006fdb47b6d653fe7cb92bb44e852435df
@@ -0,0 +1,22 @@
1
+ name: ci
2
+ on: [push, pull_request]
3
+ jobs:
4
+ ruby:
5
+ strategy:
6
+ matrix:
7
+ ruby: [2.4.x, 2.5.x, 2.6.x]
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v1
11
+ - uses: actions/setup-ruby@v1
12
+ with:
13
+ ruby-version: ${{ matrix.ruby }}
14
+ - uses: actions/setup-python@v1
15
+ with:
16
+ python-version: 3.x
17
+ - run: |
18
+ pip install --user Flask
19
+ ./JSON-Schema-Test-Suite/bin/jsonschema_suite serve &
20
+ gem install bundler
21
+ bundle install
22
+ bundle exec rake test
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_schemer (0.2.6)
4
+ json_schemer (0.2.7)
5
5
  ecma-re-validator (~> 0.2)
6
6
  hana (~> 1.3)
7
7
  regexp_parser (~> 1.5)
@@ -0,0 +1 @@
1
+ TODO
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,19 @@
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.
@@ -0,0 +1,181 @@
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.
@@ -0,0 +1,295 @@
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
+ descript = case["description"]
103
+ self.assertLess(
104
+ len(descript),
105
+ 60,
106
+ "%r is too long! (keep it to less than 60 chars)" % (descript,)
107
+ )
108
+
109
+ def test_all_descriptions_are_unique(self):
110
+ for group in groups(self.test_files):
111
+ descriptions = set(test["description"] for test in group["tests"])
112
+ self.assertEqual(
113
+ len(descriptions),
114
+ len(group["tests"]),
115
+ "%r contains a duplicate description" % (group,)
116
+ )
117
+
118
+ @unittest.skipIf(jsonschema is None, "Validation library not present!")
119
+ def test_all_schemas_are_valid(self):
120
+ for schema in os.listdir(SUITE_ROOT_DIR):
121
+ schema_validator = validators.get(schema)
122
+ if schema_validator is not None:
123
+ test_files = collect(os.path.join(SUITE_ROOT_DIR, schema))
124
+ for case in cases(test_files):
125
+ try:
126
+ schema_validator.check_schema(case["schema"])
127
+ except jsonschema.SchemaError as error:
128
+ self.fail("%s contains an invalid schema (%s)" %
129
+ (case, error))
130
+ else:
131
+ warnings.warn("No schema validator for %s" % schema)
132
+
133
+ @unittest.skipIf(jsonschema is None, "Validation library not present!")
134
+ def test_suites_are_valid(self):
135
+ validator = jsonschema.Draft4Validator(TESTSUITE_SCHEMA)
136
+ for tests in files(self.test_files):
137
+ try:
138
+ validator.validate(tests)
139
+ except jsonschema.ValidationError as error:
140
+ self.fail(str(error))
141
+
142
+ def test_remote_schemas_are_updated(self):
143
+ files = {}
144
+ for parent, _, paths in os.walk(REMOTES_DIR):
145
+ for path in paths:
146
+ absolute_path = os.path.join(parent, path)
147
+ with open(absolute_path) as schema_file:
148
+ files[absolute_path] = json.load(schema_file)
149
+
150
+ expected = {
151
+ os.path.join(REMOTES_DIR, path): contents
152
+ for path, contents in REMOTES.items()
153
+ }
154
+
155
+ missing = set(files).symmetric_difference(expected)
156
+ changed = {
157
+ path
158
+ for path, contents in expected.items()
159
+ if path in files
160
+ and contents != files[path]
161
+ }
162
+
163
+ self.assertEqual(
164
+ files,
165
+ expected,
166
+ msg=textwrap.dedent(
167
+ """
168
+ Remotes in the remotes/ directory do not match those in the
169
+ ``jsonschema_suite`` Python script.
170
+
171
+ Unfortunately for the minute, each remote file is duplicated in
172
+ two places.""" + ("""
173
+
174
+ Only present in one location:
175
+
176
+ {}""".format("\n".join(missing)) if missing else "") + ("""
177
+
178
+ Conflicting between the two:
179
+
180
+ {}""".format("\n".join(changed)) if changed else "")
181
+ )
182
+ )
183
+
184
+
185
+ def main(arguments):
186
+ if arguments.command == "check":
187
+ suite = unittest.TestLoader().loadTestsFromTestCase(SanityTests)
188
+ result = unittest.TextTestRunner(verbosity=2).run(suite)
189
+ sys.exit(not result.wasSuccessful())
190
+ elif arguments.command == "flatten":
191
+ selected_cases = [case for case in cases(collect(arguments.version))]
192
+
193
+ if arguments.randomize:
194
+ random.shuffle(selected_cases)
195
+
196
+ json.dump(selected_cases, sys.stdout, indent=4, sort_keys=True)
197
+ elif arguments.command == "remotes":
198
+ json.dump(REMOTES, sys.stdout, indent=4, sort_keys=True)
199
+ elif arguments.command == "dump_remotes":
200
+ if arguments.update:
201
+ shutil.rmtree(arguments.out_dir, ignore_errors=True)
202
+
203
+ try:
204
+ os.makedirs(arguments.out_dir)
205
+ except OSError as e:
206
+ if e.errno == errno.EEXIST:
207
+ print("%s already exists. Aborting." % arguments.out_dir)
208
+ sys.exit(1)
209
+ raise
210
+
211
+ for url, schema in REMOTES.items():
212
+ filepath = os.path.join(arguments.out_dir, url)
213
+
214
+ try:
215
+ os.makedirs(os.path.dirname(filepath))
216
+ except OSError as e:
217
+ if e.errno != errno.EEXIST:
218
+ raise
219
+
220
+ with open(filepath, "wb") as out_file:
221
+ json.dump(schema, out_file, indent=4, sort_keys=True)
222
+ elif arguments.command == "serve":
223
+ try:
224
+ from flask import Flask, jsonify
225
+ except ImportError:
226
+ print(textwrap.dedent("""
227
+ The Flask library is required to serve the remote schemas.
228
+
229
+ You can install it by running `pip install Flask`.
230
+
231
+ Alternatively, see the `jsonschema_suite remotes` or
232
+ `jsonschema_suite dump_remotes` commands to create static files
233
+ that can be served with your own web server.
234
+ """.strip("\n")))
235
+ sys.exit(1)
236
+
237
+ app = Flask(__name__)
238
+
239
+ @app.route("/<path:path>")
240
+ def serve_path(path):
241
+ if path in REMOTES:
242
+ return jsonify(REMOTES[path])
243
+ return "Document does not exist.", 404
244
+
245
+ app.run(port=1234)
246
+
247
+
248
+ parser = argparse.ArgumentParser(
249
+ description="JSON Schema Test Suite utilities",
250
+ )
251
+ subparsers = parser.add_subparsers(help="utility commands", dest="command")
252
+
253
+ check = subparsers.add_parser("check", help="Sanity check the test suite.")
254
+
255
+ flatten = subparsers.add_parser(
256
+ "flatten",
257
+ help="Output a flattened file containing a selected version's test cases."
258
+ )
259
+ flatten.add_argument(
260
+ "--randomize",
261
+ action="store_true",
262
+ help="Randomize the order of the outputted cases.",
263
+ )
264
+ flatten.add_argument(
265
+ "version", help="The directory containing the version to output",
266
+ )
267
+
268
+ remotes = subparsers.add_parser(
269
+ "remotes",
270
+ help="Output the expected URLs and their associated schemas for remote "
271
+ "ref tests as a JSON object."
272
+ )
273
+
274
+ dump_remotes = subparsers.add_parser(
275
+ "dump_remotes", help="Dump the remote ref schemas into a file tree",
276
+ )
277
+ dump_remotes.add_argument(
278
+ "--update",
279
+ action="store_true",
280
+ help="Update the remotes in an existing directory.",
281
+ )
282
+ dump_remotes.add_argument(
283
+ "--out-dir",
284
+ default=REMOTES_DIR,
285
+ type=os.path.abspath,
286
+ help="The output directory to create as the root of the file tree",
287
+ )
288
+
289
+ serve = subparsers.add_parser(
290
+ "serve",
291
+ help="Start a webserver to serve schemas used by remote ref tests."
292
+ )
293
+
294
+ if __name__ == "__main__":
295
+ main(parser.parse_args())