rj_schema 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (613) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -615
  3. data/ext/rj_schema/rapidjson/CHANGELOG.md +0 -158
  4. data/ext/rj_schema/rapidjson/CMakeLists.txt +0 -221
  5. data/ext/rj_schema/rapidjson/CMakeModules/FindGTestSrc.cmake +0 -30
  6. data/ext/rj_schema/rapidjson/RapidJSON.pc.in +0 -7
  7. data/ext/rj_schema/rapidjson/RapidJSONConfig.cmake.in +0 -15
  8. data/ext/rj_schema/rapidjson/RapidJSONConfigVersion.cmake.in +0 -10
  9. data/ext/rj_schema/rapidjson/appveyor.yml +0 -41
  10. data/ext/rj_schema/rapidjson/bin/data/glossary.json +0 -22
  11. data/ext/rj_schema/rapidjson/bin/data/menu.json +0 -27
  12. data/ext/rj_schema/rapidjson/bin/data/readme.txt +0 -1
  13. data/ext/rj_schema/rapidjson/bin/data/sample.json +0 -3315
  14. data/ext/rj_schema/rapidjson/bin/data/webapp.json +0 -88
  15. data/ext/rj_schema/rapidjson/bin/data/widget.json +0 -26
  16. data/ext/rj_schema/rapidjson/bin/draft-04/schema +0 -150
  17. data/ext/rj_schema/rapidjson/bin/encodings/utf16be.json +0 -0
  18. data/ext/rj_schema/rapidjson/bin/encodings/utf16bebom.json +0 -0
  19. data/ext/rj_schema/rapidjson/bin/encodings/utf16le.json +0 -0
  20. data/ext/rj_schema/rapidjson/bin/encodings/utf16lebom.json +0 -0
  21. data/ext/rj_schema/rapidjson/bin/encodings/utf32be.json +0 -0
  22. data/ext/rj_schema/rapidjson/bin/encodings/utf32bebom.json +0 -0
  23. data/ext/rj_schema/rapidjson/bin/encodings/utf32le.json +0 -0
  24. data/ext/rj_schema/rapidjson/bin/encodings/utf32lebom.json +0 -0
  25. data/ext/rj_schema/rapidjson/bin/encodings/utf8.json +0 -7
  26. data/ext/rj_schema/rapidjson/bin/encodings/utf8bom.json +0 -7
  27. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail1.json +0 -1
  28. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail10.json +0 -1
  29. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail11.json +0 -1
  30. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail12.json +0 -1
  31. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail13.json +0 -1
  32. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail14.json +0 -1
  33. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail15.json +0 -1
  34. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail16.json +0 -1
  35. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail17.json +0 -1
  36. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail18.json +0 -1
  37. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail19.json +0 -1
  38. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail2.json +0 -1
  39. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail20.json +0 -1
  40. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail21.json +0 -1
  41. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail22.json +0 -1
  42. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail23.json +0 -1
  43. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail24.json +0 -1
  44. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail25.json +0 -1
  45. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail26.json +0 -1
  46. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail27.json +0 -2
  47. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail28.json +0 -2
  48. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail29.json +0 -1
  49. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail3.json +0 -1
  50. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail30.json +0 -1
  51. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail31.json +0 -1
  52. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail32.json +0 -1
  53. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail33.json +0 -1
  54. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail4.json +0 -1
  55. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail5.json +0 -1
  56. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail6.json +0 -1
  57. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail7.json +0 -1
  58. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail8.json +0 -1
  59. data/ext/rj_schema/rapidjson/bin/jsonchecker/fail9.json +0 -1
  60. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass1.json +0 -58
  61. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass2.json +0 -1
  62. data/ext/rj_schema/rapidjson/bin/jsonchecker/pass3.json +0 -6
  63. data/ext/rj_schema/rapidjson/bin/jsonchecker/readme.txt +0 -3
  64. data/ext/rj_schema/rapidjson/bin/jsonschema/LICENSE +0 -19
  65. data/ext/rj_schema/rapidjson/bin/jsonschema/README.md +0 -148
  66. data/ext/rj_schema/rapidjson/bin/jsonschema/bin/jsonschema_suite +0 -283
  67. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/folder/folderInteger.json +0 -3
  68. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/integer.json +0 -3
  69. data/ext/rj_schema/rapidjson/bin/jsonschema/remotes/subSchemas.json +0 -8
  70. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalItems.json +0 -82
  71. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/additionalProperties.json +0 -88
  72. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/default.json +0 -49
  73. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/dependencies.json +0 -108
  74. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/disallow.json +0 -80
  75. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/divisibleBy.json +0 -60
  76. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/enum.json +0 -71
  77. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/extends.json +0 -94
  78. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/items.json +0 -46
  79. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxItems.json +0 -28
  80. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maxLength.json +0 -33
  81. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/maximum.json +0 -42
  82. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minItems.json +0 -28
  83. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minLength.json +0 -33
  84. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/minimum.json +0 -42
  85. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/bignum.json +0 -107
  86. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/format.json +0 -222
  87. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/jsregex.json +0 -18
  88. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json +0 -15
  89. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/pattern.json +0 -34
  90. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/patternProperties.json +0 -110
  91. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/properties.json +0 -92
  92. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/ref.json +0 -159
  93. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/refRemote.json +0 -74
  94. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/required.json +0 -53
  95. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/type.json +0 -474
  96. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft3/uniqueItems.json +0 -79
  97. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalItems.json +0 -82
  98. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/additionalProperties.json +0 -88
  99. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/allOf.json +0 -112
  100. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/anyOf.json +0 -68
  101. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/default.json +0 -49
  102. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/definitions.json +0 -32
  103. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/dependencies.json +0 -113
  104. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/enum.json +0 -72
  105. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/items.json +0 -46
  106. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxItems.json +0 -28
  107. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxLength.json +0 -33
  108. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maxProperties.json +0 -28
  109. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/maximum.json +0 -42
  110. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minItems.json +0 -28
  111. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minLength.json +0 -33
  112. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minProperties.json +0 -28
  113. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/minimum.json +0 -42
  114. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/multipleOf.json +0 -60
  115. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/not.json +0 -96
  116. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/oneOf.json +0 -68
  117. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/bignum.json +0 -107
  118. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/format.json +0 -148
  119. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json +0 -15
  120. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/pattern.json +0 -34
  121. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/patternProperties.json +0 -110
  122. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/properties.json +0 -92
  123. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/ref.json +0 -159
  124. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/refRemote.json +0 -74
  125. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/required.json +0 -39
  126. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/type.json +0 -330
  127. data/ext/rj_schema/rapidjson/bin/jsonschema/tests/draft4/uniqueItems.json +0 -79
  128. data/ext/rj_schema/rapidjson/bin/jsonschema/tox.ini +0 -8
  129. data/ext/rj_schema/rapidjson/bin/types/booleans.json +0 -102
  130. data/ext/rj_schema/rapidjson/bin/types/floats.json +0 -102
  131. data/ext/rj_schema/rapidjson/bin/types/guids.json +0 -102
  132. data/ext/rj_schema/rapidjson/bin/types/integers.json +0 -102
  133. data/ext/rj_schema/rapidjson/bin/types/mixed.json +0 -592
  134. data/ext/rj_schema/rapidjson/bin/types/nulls.json +0 -102
  135. data/ext/rj_schema/rapidjson/bin/types/paragraphs.json +0 -102
  136. data/ext/rj_schema/rapidjson/bin/types/readme.txt +0 -1
  137. data/ext/rj_schema/rapidjson/contrib/natvis/LICENSE +0 -45
  138. data/ext/rj_schema/rapidjson/contrib/natvis/README.md +0 -7
  139. data/ext/rj_schema/rapidjson/contrib/natvis/rapidjson.natvis +0 -38
  140. data/ext/rj_schema/rapidjson/doc/CMakeLists.txt +0 -27
  141. data/ext/rj_schema/rapidjson/doc/Doxyfile.in +0 -2369
  142. data/ext/rj_schema/rapidjson/doc/Doxyfile.zh-cn.in +0 -2369
  143. data/ext/rj_schema/rapidjson/doc/diagram/architecture.dot +0 -50
  144. data/ext/rj_schema/rapidjson/doc/diagram/architecture.png +0 -0
  145. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.dot +0 -65
  146. data/ext/rj_schema/rapidjson/doc/diagram/insituparsing.png +0 -0
  147. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.dot +0 -62
  148. data/ext/rj_schema/rapidjson/doc/diagram/iterative-parser-states-diagram.png +0 -0
  149. data/ext/rj_schema/rapidjson/doc/diagram/makefile +0 -8
  150. data/ext/rj_schema/rapidjson/doc/diagram/move1.dot +0 -47
  151. data/ext/rj_schema/rapidjson/doc/diagram/move1.png +0 -0
  152. data/ext/rj_schema/rapidjson/doc/diagram/move2.dot +0 -62
  153. data/ext/rj_schema/rapidjson/doc/diagram/move2.png +0 -0
  154. data/ext/rj_schema/rapidjson/doc/diagram/move3.dot +0 -60
  155. data/ext/rj_schema/rapidjson/doc/diagram/move3.png +0 -0
  156. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.dot +0 -56
  157. data/ext/rj_schema/rapidjson/doc/diagram/normalparsing.png +0 -0
  158. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.dot +0 -54
  159. data/ext/rj_schema/rapidjson/doc/diagram/simpledom.png +0 -0
  160. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.dot +0 -58
  161. data/ext/rj_schema/rapidjson/doc/diagram/tutorial.png +0 -0
  162. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.dot +0 -73
  163. data/ext/rj_schema/rapidjson/doc/diagram/utilityclass.png +0 -0
  164. data/ext/rj_schema/rapidjson/doc/dom.md +0 -280
  165. data/ext/rj_schema/rapidjson/doc/dom.zh-cn.md +0 -284
  166. data/ext/rj_schema/rapidjson/doc/encoding.md +0 -146
  167. data/ext/rj_schema/rapidjson/doc/encoding.zh-cn.md +0 -152
  168. data/ext/rj_schema/rapidjson/doc/faq.md +0 -289
  169. data/ext/rj_schema/rapidjson/doc/faq.zh-cn.md +0 -290
  170. data/ext/rj_schema/rapidjson/doc/features.md +0 -104
  171. data/ext/rj_schema/rapidjson/doc/features.zh-cn.md +0 -103
  172. data/ext/rj_schema/rapidjson/doc/internals.md +0 -368
  173. data/ext/rj_schema/rapidjson/doc/internals.zh-cn.md +0 -363
  174. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.png +0 -0
  175. data/ext/rj_schema/rapidjson/doc/logo/rapidjson.svg +0 -119
  176. data/ext/rj_schema/rapidjson/doc/misc/DoxygenLayout.xml +0 -194
  177. data/ext/rj_schema/rapidjson/doc/misc/doxygenextra.css +0 -274
  178. data/ext/rj_schema/rapidjson/doc/misc/footer.html +0 -11
  179. data/ext/rj_schema/rapidjson/doc/misc/header.html +0 -24
  180. data/ext/rj_schema/rapidjson/doc/npm.md +0 -31
  181. data/ext/rj_schema/rapidjson/doc/performance.md +0 -26
  182. data/ext/rj_schema/rapidjson/doc/performance.zh-cn.md +0 -26
  183. data/ext/rj_schema/rapidjson/doc/pointer.md +0 -234
  184. data/ext/rj_schema/rapidjson/doc/pointer.zh-cn.md +0 -234
  185. data/ext/rj_schema/rapidjson/doc/sax.md +0 -509
  186. data/ext/rj_schema/rapidjson/doc/sax.zh-cn.md +0 -487
  187. data/ext/rj_schema/rapidjson/doc/schema.md +0 -505
  188. data/ext/rj_schema/rapidjson/doc/schema.zh-cn.md +0 -237
  189. data/ext/rj_schema/rapidjson/doc/stream.md +0 -429
  190. data/ext/rj_schema/rapidjson/doc/stream.zh-cn.md +0 -429
  191. data/ext/rj_schema/rapidjson/doc/tutorial.md +0 -536
  192. data/ext/rj_schema/rapidjson/doc/tutorial.zh-cn.md +0 -534
  193. data/ext/rj_schema/rapidjson/docker/debian/Dockerfile +0 -8
  194. data/ext/rj_schema/rapidjson/example/CMakeLists.txt +0 -45
  195. data/ext/rj_schema/rapidjson/example/archiver/archiver.cpp +0 -292
  196. data/ext/rj_schema/rapidjson/example/archiver/archiver.h +0 -145
  197. data/ext/rj_schema/rapidjson/example/archiver/archivertest.cpp +0 -287
  198. data/ext/rj_schema/rapidjson/example/capitalize/capitalize.cpp +0 -67
  199. data/ext/rj_schema/rapidjson/example/condense/condense.cpp +0 -32
  200. data/ext/rj_schema/rapidjson/example/filterkey/filterkey.cpp +0 -135
  201. data/ext/rj_schema/rapidjson/example/filterkeydom/filterkeydom.cpp +0 -170
  202. data/ext/rj_schema/rapidjson/example/jsonx/jsonx.cpp +0 -207
  203. data/ext/rj_schema/rapidjson/example/lookaheadparser/lookaheadparser.cpp +0 -350
  204. data/ext/rj_schema/rapidjson/example/messagereader/messagereader.cpp +0 -105
  205. data/ext/rj_schema/rapidjson/example/parsebyparts/parsebyparts.cpp +0 -176
  206. data/ext/rj_schema/rapidjson/example/pretty/pretty.cpp +0 -30
  207. data/ext/rj_schema/rapidjson/example/prettyauto/prettyauto.cpp +0 -56
  208. data/ext/rj_schema/rapidjson/example/schemavalidator/schemavalidator.cpp +0 -78
  209. data/ext/rj_schema/rapidjson/example/serialize/serialize.cpp +0 -173
  210. data/ext/rj_schema/rapidjson/example/simpledom/simpledom.cpp +0 -29
  211. data/ext/rj_schema/rapidjson/example/simplepullreader/simplepullreader.cpp +0 -53
  212. data/ext/rj_schema/rapidjson/example/simplereader/simplereader.cpp +0 -42
  213. data/ext/rj_schema/rapidjson/example/simplewriter/simplewriter.cpp +0 -36
  214. data/ext/rj_schema/rapidjson/example/tutorial/tutorial.cpp +0 -151
  215. data/ext/rj_schema/rapidjson/include/rapidjson/allocators.h +0 -284
  216. data/ext/rj_schema/rapidjson/include/rapidjson/cursorstreamwrapper.h +0 -78
  217. data/ext/rj_schema/rapidjson/include/rapidjson/document.h +0 -2648
  218. data/ext/rj_schema/rapidjson/include/rapidjson/encodedstream.h +0 -299
  219. data/ext/rj_schema/rapidjson/include/rapidjson/encodings.h +0 -716
  220. data/ext/rj_schema/rapidjson/include/rapidjson/error/en.h +0 -74
  221. data/ext/rj_schema/rapidjson/include/rapidjson/error/error.h +0 -161
  222. data/ext/rj_schema/rapidjson/include/rapidjson/filereadstream.h +0 -99
  223. data/ext/rj_schema/rapidjson/include/rapidjson/filewritestream.h +0 -104
  224. data/ext/rj_schema/rapidjson/include/rapidjson/fwd.h +0 -151
  225. data/ext/rj_schema/rapidjson/include/rapidjson/internal/biginteger.h +0 -290
  226. data/ext/rj_schema/rapidjson/include/rapidjson/internal/diyfp.h +0 -271
  227. data/ext/rj_schema/rapidjson/include/rapidjson/internal/dtoa.h +0 -245
  228. data/ext/rj_schema/rapidjson/include/rapidjson/internal/ieee754.h +0 -78
  229. data/ext/rj_schema/rapidjson/include/rapidjson/internal/itoa.h +0 -308
  230. data/ext/rj_schema/rapidjson/include/rapidjson/internal/meta.h +0 -186
  231. data/ext/rj_schema/rapidjson/include/rapidjson/internal/pow10.h +0 -55
  232. data/ext/rj_schema/rapidjson/include/rapidjson/internal/regex.h +0 -732
  233. data/ext/rj_schema/rapidjson/include/rapidjson/internal/stack.h +0 -231
  234. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strfunc.h +0 -69
  235. data/ext/rj_schema/rapidjson/include/rapidjson/internal/strtod.h +0 -290
  236. data/ext/rj_schema/rapidjson/include/rapidjson/internal/swap.h +0 -46
  237. data/ext/rj_schema/rapidjson/include/rapidjson/istreamwrapper.h +0 -113
  238. data/ext/rj_schema/rapidjson/include/rapidjson/memorybuffer.h +0 -70
  239. data/ext/rj_schema/rapidjson/include/rapidjson/memorystream.h +0 -71
  240. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/inttypes.h +0 -316
  241. data/ext/rj_schema/rapidjson/include/rapidjson/msinttypes/stdint.h +0 -300
  242. data/ext/rj_schema/rapidjson/include/rapidjson/ostreamwrapper.h +0 -81
  243. data/ext/rj_schema/rapidjson/include/rapidjson/pointer.h +0 -1357
  244. data/ext/rj_schema/rapidjson/include/rapidjson/prettywriter.h +0 -277
  245. data/ext/rj_schema/rapidjson/include/rapidjson/rapidjson.h +0 -630
  246. data/ext/rj_schema/rapidjson/include/rapidjson/reader.h +0 -2230
  247. data/ext/rj_schema/rapidjson/include/rapidjson/schema.h +0 -2494
  248. data/ext/rj_schema/rapidjson/include/rapidjson/stream.h +0 -223
  249. data/ext/rj_schema/rapidjson/include/rapidjson/stringbuffer.h +0 -121
  250. data/ext/rj_schema/rapidjson/include/rapidjson/writer.h +0 -710
  251. data/ext/rj_schema/rapidjson/include_dirs.js +0 -2
  252. data/ext/rj_schema/rapidjson/library.json +0 -15
  253. data/ext/rj_schema/rapidjson/license.txt +0 -57
  254. data/ext/rj_schema/rapidjson/package.json +0 -24
  255. data/ext/rj_schema/rapidjson/rapidjson.autopkg +0 -77
  256. data/ext/rj_schema/rapidjson/readme.md +0 -160
  257. data/ext/rj_schema/rapidjson/readme.zh-cn.md +0 -152
  258. data/ext/rj_schema/rapidjson/test/CMakeLists.txt +0 -20
  259. data/ext/rj_schema/rapidjson/test/perftest/CMakeLists.txt +0 -28
  260. data/ext/rj_schema/rapidjson/test/perftest/misctest.cpp +0 -974
  261. data/ext/rj_schema/rapidjson/test/perftest/perftest.cpp +0 -24
  262. data/ext/rj_schema/rapidjson/test/perftest/perftest.h +0 -185
  263. data/ext/rj_schema/rapidjson/test/perftest/platformtest.cpp +0 -166
  264. data/ext/rj_schema/rapidjson/test/perftest/rapidjsontest.cpp +0 -472
  265. data/ext/rj_schema/rapidjson/test/perftest/schematest.cpp +0 -223
  266. data/ext/rj_schema/rapidjson/test/unittest/CMakeLists.txt +0 -92
  267. data/ext/rj_schema/rapidjson/test/unittest/allocatorstest.cpp +0 -100
  268. data/ext/rj_schema/rapidjson/test/unittest/bigintegertest.cpp +0 -138
  269. data/ext/rj_schema/rapidjson/test/unittest/cursorstreamwrappertest.cpp +0 -115
  270. data/ext/rj_schema/rapidjson/test/unittest/documenttest.cpp +0 -672
  271. data/ext/rj_schema/rapidjson/test/unittest/dtoatest.cpp +0 -98
  272. data/ext/rj_schema/rapidjson/test/unittest/encodedstreamtest.cpp +0 -313
  273. data/ext/rj_schema/rapidjson/test/unittest/encodingstest.cpp +0 -451
  274. data/ext/rj_schema/rapidjson/test/unittest/filestreamtest.cpp +0 -112
  275. data/ext/rj_schema/rapidjson/test/unittest/fwdtest.cpp +0 -230
  276. data/ext/rj_schema/rapidjson/test/unittest/istreamwrappertest.cpp +0 -181
  277. data/ext/rj_schema/rapidjson/test/unittest/itoatest.cpp +0 -160
  278. data/ext/rj_schema/rapidjson/test/unittest/jsoncheckertest.cpp +0 -143
  279. data/ext/rj_schema/rapidjson/test/unittest/namespacetest.cpp +0 -70
  280. data/ext/rj_schema/rapidjson/test/unittest/ostreamwrappertest.cpp +0 -92
  281. data/ext/rj_schema/rapidjson/test/unittest/pointertest.cpp +0 -1529
  282. data/ext/rj_schema/rapidjson/test/unittest/prettywritertest.cpp +0 -373
  283. data/ext/rj_schema/rapidjson/test/unittest/readertest.cpp +0 -2190
  284. data/ext/rj_schema/rapidjson/test/unittest/regextest.cpp +0 -638
  285. data/ext/rj_schema/rapidjson/test/unittest/schematest.cpp +0 -2072
  286. data/ext/rj_schema/rapidjson/test/unittest/simdtest.cpp +0 -219
  287. data/ext/rj_schema/rapidjson/test/unittest/strfunctest.cpp +0 -30
  288. data/ext/rj_schema/rapidjson/test/unittest/stringbuffertest.cpp +0 -192
  289. data/ext/rj_schema/rapidjson/test/unittest/strtodtest.cpp +0 -132
  290. data/ext/rj_schema/rapidjson/test/unittest/unittest.cpp +0 -51
  291. data/ext/rj_schema/rapidjson/test/unittest/unittest.h +0 -140
  292. data/ext/rj_schema/rapidjson/test/unittest/valuetest.cpp +0 -1851
  293. data/ext/rj_schema/rapidjson/test/unittest/writertest.cpp +0 -598
  294. data/ext/rj_schema/rapidjson/test/valgrind.supp +0 -17
  295. data/ext/rj_schema/rapidjson/thirdparty/gtest/CMakeLists.txt +0 -16
  296. data/ext/rj_schema/rapidjson/thirdparty/gtest/README.md +0 -141
  297. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CHANGES +0 -126
  298. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt +0 -202
  299. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/CONTRIBUTORS +0 -40
  300. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/LICENSE +0 -28
  301. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/Makefile.am +0 -224
  302. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/README.md +0 -333
  303. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/configure.ac +0 -146
  304. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CheatSheet.md +0 -562
  305. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/CookBook.md +0 -3675
  306. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DesignDoc.md +0 -280
  307. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/DevGuide.md +0 -132
  308. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/Documentation.md +0 -12
  309. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/ForDummies.md +0 -439
  310. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/FrequentlyAskedQuestions.md +0 -628
  311. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/KnownIssues.md +0 -19
  312. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CheatSheet.md +0 -525
  313. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/CookBook.md +0 -3250
  314. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/Documentation.md +0 -11
  315. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/ForDummies.md +0 -439
  316. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md +0 -624
  317. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CheatSheet.md +0 -534
  318. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/CookBook.md +0 -3342
  319. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/Documentation.md +0 -12
  320. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/ForDummies.md +0 -439
  321. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_6/FrequentlyAskedQuestions.md +0 -628
  322. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CheatSheet.md +0 -556
  323. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/CookBook.md +0 -3432
  324. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/Documentation.md +0 -12
  325. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/ForDummies.md +0 -439
  326. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/docs/v1_7/FrequentlyAskedQuestions.md +0 -628
  327. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-actions.h +0 -1205
  328. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-cardinalities.h +0 -147
  329. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h +0 -2377
  330. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-actions.h.pump +0 -794
  331. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h +0 -1095
  332. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +0 -291
  333. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h +0 -2179
  334. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-matchers.h.pump +0 -672
  335. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h +0 -397
  336. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-nice-strict.h.pump +0 -161
  337. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h +0 -4399
  338. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-actions.h +0 -246
  339. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-more-matchers.h +0 -58
  340. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h +0 -1847
  341. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock.h +0 -94
  342. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +0 -8
  343. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +0 -10
  344. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-matchers.h +0 -39
  345. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/custom/gmock-port.h +0 -46
  346. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h +0 -279
  347. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump +0 -136
  348. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-internal-utils.h +0 -511
  349. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/include/gmock/internal/gmock-port.h +0 -91
  350. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/make/Makefile +0 -101
  351. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.sln +0 -32
  352. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock.vcproj +0 -191
  353. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_config.vsprops +0 -15
  354. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_main.vcproj +0 -187
  355. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2005/gmock_test.vcproj +0 -201
  356. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.sln +0 -32
  357. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock.vcxproj +0 -82
  358. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_config.props +0 -19
  359. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_main.vcxproj +0 -88
  360. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2010/gmock_test.vcxproj +0 -101
  361. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.sln +0 -32
  362. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock.vcxproj +0 -84
  363. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_config.props +0 -19
  364. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_main.vcxproj +0 -90
  365. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/msvc/2015/gmock_test.vcxproj +0 -103
  366. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/fuse_gmock_files.py +0 -240
  367. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/LICENSE +0 -203
  368. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README +0 -35
  369. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/README.cppclean +0 -115
  370. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/__init__.py +0 -0
  371. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/ast.py +0 -1733
  372. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class.py +0 -227
  373. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/gmock_class_test.py +0 -448
  374. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/keywords.py +0 -59
  375. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/tokenize.py +0 -287
  376. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/cpp/utils.py +0 -41
  377. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/generator/gmock_gen.py +0 -31
  378. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock-config.in +0 -303
  379. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/gmock_doctor.py +0 -640
  380. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload.py +0 -1387
  381. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/scripts/upload_gmock.py +0 -78
  382. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-all.cc +0 -47
  383. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-cardinalities.cc +0 -156
  384. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-internal-utils.cc +0 -174
  385. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-matchers.cc +0 -498
  386. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock-spec-builders.cc +0 -823
  387. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock.cc +0 -183
  388. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/src/gmock_main.cc +0 -54
  389. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-actions_test.cc +0 -1411
  390. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-cardinalities_test.cc +0 -428
  391. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-actions_test.cc +0 -1228
  392. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-function-mockers_test.cc +0 -622
  393. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-internal-utils_test.cc +0 -127
  394. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-generated-matchers_test.cc +0 -1286
  395. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-internal-utils_test.cc +0 -699
  396. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-matchers_test.cc +0 -5648
  397. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-more-actions_test.cc +0 -708
  398. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-nice-strict_test.cc +0 -424
  399. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-port_test.cc +0 -43
  400. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock-spec-builders_test.cc +0 -2644
  401. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_all_test.cc +0 -51
  402. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_ex_test.cc +0 -81
  403. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test.py +0 -108
  404. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_leak_test_.cc +0 -100
  405. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link2_test.cc +0 -40
  406. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.cc +0 -40
  407. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_link_test.h +0 -669
  408. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test.py +0 -180
  409. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_.cc +0 -291
  410. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_output_test_golden.txt +0 -310
  411. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_stress_test.cc +0 -322
  412. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test.cc +0 -220
  413. data/ext/rj_schema/rapidjson/thirdparty/gtest/googlemock/test/gmock_test_utils.py +0 -112
  414. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CHANGES +0 -157
  415. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt +0 -286
  416. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/CONTRIBUTORS +0 -37
  417. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/LICENSE +0 -28
  418. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/Makefile.am +0 -310
  419. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/README.md +0 -280
  420. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/cmake/internal_utils.cmake +0 -242
  421. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.cbproj +0 -138
  422. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest.groupproj +0 -54
  423. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_all.cc +0 -38
  424. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_link.cc +0 -40
  425. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_main.cbproj +0 -82
  426. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/codegear/gtest_unittest.cbproj +0 -88
  427. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/configure.ac +0 -68
  428. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/AdvancedGuide.md +0 -2182
  429. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/DevGuide.md +0 -126
  430. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Documentation.md +0 -14
  431. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/FAQ.md +0 -1087
  432. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Primer.md +0 -502
  433. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/PumpManual.md +0 -177
  434. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/Samples.md +0 -14
  435. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_AdvancedGuide.md +0 -2096
  436. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Documentation.md +0 -12
  437. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_FAQ.md +0 -886
  438. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_Primer.md +0 -497
  439. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_PumpManual.md +0 -177
  440. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_5_XcodeGuide.md +0 -93
  441. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_AdvancedGuide.md +0 -2178
  442. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Documentation.md +0 -14
  443. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_FAQ.md +0 -1038
  444. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Primer.md +0 -501
  445. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_PumpManual.md +0 -177
  446. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_Samples.md +0 -14
  447. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_6_XcodeGuide.md +0 -93
  448. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_AdvancedGuide.md +0 -2181
  449. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Documentation.md +0 -14
  450. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_FAQ.md +0 -1082
  451. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Primer.md +0 -501
  452. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_PumpManual.md +0 -177
  453. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_Samples.md +0 -14
  454. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/V1_7_XcodeGuide.md +0 -93
  455. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/docs/XcodeGuide.md +0 -93
  456. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-death-test.h +0 -294
  457. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-message.h +0 -250
  458. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h +0 -1444
  459. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-param-test.h.pump +0 -510
  460. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-printers.h +0 -993
  461. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-spi.h +0 -232
  462. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-test-part.h +0 -179
  463. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest-typed-test.h +0 -263
  464. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest.h +0 -2236
  465. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_pred_impl.h +0 -358
  466. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/gtest_prod.h +0 -58
  467. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-port.h +0 -69
  468. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
  469. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/custom/gtest.h +0 -41
  470. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -319
  471. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h +0 -206
  472. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-internal.h +0 -1238
  473. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
  474. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5146
  475. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -286
  476. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-param-util.h +0 -731
  477. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port-arch.h +0 -93
  478. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-port.h +0 -2554
  479. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-string.h +0 -167
  480. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
  481. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
  482. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h +0 -3331
  483. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -297
  484. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/acx_pthread.m4 +0 -363
  485. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/m4/gtest.m4 +0 -74
  486. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/make/Makefile +0 -82
  487. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.sln +0 -45
  488. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest-md.vcproj +0 -126
  489. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.sln +0 -45
  490. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest.vcproj +0 -126
  491. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main-md.vcproj +0 -129
  492. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_main.vcproj +0 -129
  493. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test-md.vcproj +0 -164
  494. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_prod_test.vcproj +0 -164
  495. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest-md.vcproj +0 -147
  496. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/msvc/gtest_unittest.vcproj +0 -147
  497. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/prime_tables.h +0 -123
  498. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.cc +0 -68
  499. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1.h +0 -43
  500. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample10_unittest.cc +0 -144
  501. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample1_unittest.cc +0 -153
  502. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.cc +0 -56
  503. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2.h +0 -85
  504. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample2_unittest.cc +0 -109
  505. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3-inl.h +0 -172
  506. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample3_unittest.cc +0 -151
  507. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.cc +0 -46
  508. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4.h +0 -53
  509. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample4_unittest.cc +0 -45
  510. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample5_unittest.cc +0 -199
  511. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample6_unittest.cc +0 -224
  512. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample7_unittest.cc +0 -130
  513. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample8_unittest.cc +0 -173
  514. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/samples/sample9_unittest.cc +0 -160
  515. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/common.py +0 -83
  516. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/fuse_gtest_files.py +0 -253
  517. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gen_gtest_pred_impl.py +0 -730
  518. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/gtest-config.in +0 -274
  519. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/pump.py +0 -855
  520. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/release_docs.py +0 -158
  521. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/test/Makefile +0 -59
  522. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload.py +0 -1387
  523. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/scripts/upload_gtest.py +0 -78
  524. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-all.cc +0 -48
  525. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-death-test.cc +0 -1342
  526. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-filepath.cc +0 -387
  527. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-internal-inl.h +0 -1183
  528. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-port.cc +0 -1259
  529. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-printers.cc +0 -373
  530. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-test-part.cc +0 -110
  531. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest-typed-test.cc +0 -118
  532. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest.cc +0 -5388
  533. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/src/gtest_main.cc +0 -38
  534. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_ex_test.cc +0 -93
  535. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-death-test_test.cc +0 -1427
  536. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-filepath_test.cc +0 -662
  537. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-linked_ptr_test.cc +0 -154
  538. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-listener_test.cc +0 -311
  539. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-message_test.cc +0 -159
  540. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-options_test.cc +0 -215
  541. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test2_test.cc +0 -65
  542. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.cc +0 -1055
  543. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-param-test_test.h +0 -57
  544. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-port_test.cc +0 -1304
  545. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-printers_test.cc +0 -1635
  546. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-test-part_test.cc +0 -208
  547. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-tuple_test.cc +0 -320
  548. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test2_test.cc +0 -45
  549. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.cc +0 -380
  550. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-typed-test_test.h +0 -66
  551. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest-unittest-api_test.cc +0 -341
  552. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_all_test.cc +0 -47
  553. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest.py +0 -212
  554. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_break_on_failure_unittest_.cc +0 -88
  555. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test.py +0 -237
  556. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_catch_exceptions_test_.cc +0 -311
  557. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test.py +0 -130
  558. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_color_test_.cc +0 -71
  559. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test.py +0 -117
  560. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_env_var_test_.cc +0 -126
  561. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_environment_test.cc +0 -192
  562. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest.py +0 -636
  563. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_filter_unittest_.cc +0 -140
  564. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test.py +0 -172
  565. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_help_test_.cc +0 -46
  566. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest.py +0 -207
  567. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_list_tests_unittest_.cc +0 -157
  568. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_main_unittest.cc +0 -45
  569. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_no_test_unittest.cc +0 -56
  570. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test.py +0 -340
  571. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_.cc +0 -1062
  572. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_output_test_golden_lin.txt +0 -743
  573. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_pred_impl_unittest.cc +0 -2427
  574. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_premature_exit_test.cc +0 -127
  575. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_prod_test.cc +0 -57
  576. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_repeat_test.cc +0 -253
  577. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test.py +0 -325
  578. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_shuffle_test_.cc +0 -103
  579. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_sole_header_test.cc +0 -57
  580. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_stress_test.cc +0 -256
  581. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_test_utils.py +0 -320
  582. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_ex_test.cc +0 -92
  583. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test.py +0 -171
  584. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_throw_on_failure_test_.cc +0 -72
  585. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test.py +0 -70
  586. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_uninitialized_test_.cc +0 -43
  587. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_unittest.cc +0 -7706
  588. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile1_test_.cc +0 -49
  589. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfile2_test_.cc +0 -49
  590. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_outfiles_test.py +0 -132
  591. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest.py +0 -308
  592. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_output_unittest_.cc +0 -181
  593. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/gtest_xml_test_utils.py +0 -194
  594. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.cc +0 -36
  595. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/test/production.h +0 -55
  596. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/DebugProject.xcconfig +0 -30
  597. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/FrameworkTarget.xcconfig +0 -17
  598. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/General.xcconfig +0 -41
  599. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/ReleaseProject.xcconfig +0 -32
  600. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/StaticLibraryTarget.xcconfig +0 -18
  601. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Config/TestTarget.xcconfig +0 -8
  602. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Resources/Info.plist +0 -30
  603. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/Info.plist +0 -28
  604. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj +0 -457
  605. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/runtests.sh +0 -62
  606. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.cc +0 -63
  607. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget.h +0 -59
  608. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Samples/FrameworkSample/widget_test.cc +0 -68
  609. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/runtests.sh +0 -65
  610. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/Scripts/versiongenerate.py +0 -100
  611. data/ext/rj_schema/rapidjson/thirdparty/gtest/googletest/xcode/gtest.xcodeproj/project.pbxproj +0 -1135
  612. data/ext/rj_schema/rapidjson/thirdparty/gtest/travis.sh +0 -15
  613. data/ext/rj_schema/rapidjson/travis-doxygen.sh +0 -121
@@ -1,2072 +0,0 @@
1
- // Tencent is pleased to support the open source community by making RapidJSON available.
2
- //
3
- // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4
- //
5
- // Licensed under the MIT License (the "License"); you may not use this file except
6
- // in compliance with the License. You may obtain a copy of the License at
7
- //
8
- // http://opensource.org/licenses/MIT
9
- //
10
- // Unless required by applicable law or agreed to in writing, software distributed
11
- // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
- // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
- // specific language governing permissions and limitations under the License.
14
-
15
- #include "unittest.h"
16
- #include "rapidjson/schema.h"
17
- #include "rapidjson/stringbuffer.h"
18
- #include "rapidjson/writer.h"
19
-
20
- #ifdef __clang__
21
- RAPIDJSON_DIAG_PUSH
22
- RAPIDJSON_DIAG_OFF(variadic-macros)
23
- #elif defined(_MSC_VER)
24
- RAPIDJSON_DIAG_PUSH
25
- RAPIDJSON_DIAG_OFF(4822) // local class member function does not have a body
26
- #endif
27
-
28
- using namespace rapidjson;
29
-
30
- #define TEST_HASHER(json1, json2, expected) \
31
- {\
32
- Document d1, d2;\
33
- d1.Parse(json1);\
34
- ASSERT_FALSE(d1.HasParseError());\
35
- d2.Parse(json2);\
36
- ASSERT_FALSE(d2.HasParseError());\
37
- internal::Hasher<Value, CrtAllocator> h1, h2;\
38
- d1.Accept(h1);\
39
- d2.Accept(h2);\
40
- ASSERT_TRUE(h1.IsValid());\
41
- ASSERT_TRUE(h2.IsValid());\
42
- /*printf("%s: 0x%016llx\n%s: 0x%016llx\n\n", json1, h1.GetHashCode(), json2, h2.GetHashCode());*/\
43
- EXPECT_TRUE(expected == (h1.GetHashCode() == h2.GetHashCode()));\
44
- }
45
-
46
- TEST(SchemaValidator, Hasher) {
47
- TEST_HASHER("null", "null", true);
48
-
49
- TEST_HASHER("true", "true", true);
50
- TEST_HASHER("false", "false", true);
51
- TEST_HASHER("true", "false", false);
52
- TEST_HASHER("false", "true", false);
53
- TEST_HASHER("true", "null", false);
54
- TEST_HASHER("false", "null", false);
55
-
56
- TEST_HASHER("1", "1", true);
57
- TEST_HASHER("2147483648", "2147483648", true); // 2^31 can only be fit in unsigned
58
- TEST_HASHER("-2147483649", "-2147483649", true); // -2^31 - 1 can only be fit in int64_t
59
- TEST_HASHER("2147483648", "2147483648", true); // 2^31 can only be fit in unsigned
60
- TEST_HASHER("4294967296", "4294967296", true); // 2^32 can only be fit in int64_t
61
- TEST_HASHER("9223372036854775808", "9223372036854775808", true); // 2^63 can only be fit in uint64_t
62
- TEST_HASHER("1.5", "1.5", true);
63
- TEST_HASHER("1", "1.0", true);
64
- TEST_HASHER("1", "-1", false);
65
- TEST_HASHER("0.0", "-0.0", false);
66
- TEST_HASHER("1", "true", false);
67
- TEST_HASHER("0", "false", false);
68
- TEST_HASHER("0", "null", false);
69
-
70
- TEST_HASHER("\"\"", "\"\"", true);
71
- TEST_HASHER("\"\"", "\"\\u0000\"", false);
72
- TEST_HASHER("\"Hello\"", "\"Hello\"", true);
73
- TEST_HASHER("\"Hello\"", "\"World\"", false);
74
- TEST_HASHER("\"Hello\"", "null", false);
75
- TEST_HASHER("\"Hello\\u0000\"", "\"Hello\"", false);
76
- TEST_HASHER("\"\"", "null", false);
77
- TEST_HASHER("\"\"", "true", false);
78
- TEST_HASHER("\"\"", "false", false);
79
-
80
- TEST_HASHER("[]", "[ ]", true);
81
- TEST_HASHER("[1, true, false]", "[1, true, false]", true);
82
- TEST_HASHER("[1, true, false]", "[1, true]", false);
83
- TEST_HASHER("[1, 2]", "[2, 1]", false);
84
- TEST_HASHER("[[1], 2]", "[[1, 2]]", false);
85
- TEST_HASHER("[1, 2]", "[1, [2]]", false);
86
- TEST_HASHER("[]", "null", false);
87
- TEST_HASHER("[]", "true", false);
88
- TEST_HASHER("[]", "false", false);
89
- TEST_HASHER("[]", "0", false);
90
- TEST_HASHER("[]", "0.0", false);
91
- TEST_HASHER("[]", "\"\"", false);
92
-
93
- TEST_HASHER("{}", "{ }", true);
94
- TEST_HASHER("{\"a\":1}", "{\"a\":1}", true);
95
- TEST_HASHER("{\"a\":1}", "{\"b\":1}", false);
96
- TEST_HASHER("{\"a\":1}", "{\"a\":2}", false);
97
- TEST_HASHER("{\"a\":1, \"b\":2}", "{\"b\":2, \"a\":1}", true); // Member order insensitive
98
- TEST_HASHER("{}", "null", false);
99
- TEST_HASHER("{}", "false", false);
100
- TEST_HASHER("{}", "true", false);
101
- TEST_HASHER("{}", "0", false);
102
- TEST_HASHER("{}", "0.0", false);
103
- TEST_HASHER("{}", "\"\"", false);
104
- }
105
-
106
- // Test cases following http://spacetelescope.github.io/understanding-json-schema
107
-
108
- #define VALIDATE(schema, json, expected) \
109
- {\
110
- SchemaValidator validator(schema);\
111
- Document d;\
112
- /*printf("\n%s\n", json);*/\
113
- d.Parse(json);\
114
- EXPECT_FALSE(d.HasParseError());\
115
- EXPECT_TRUE(expected == d.Accept(validator));\
116
- EXPECT_TRUE(expected == validator.IsValid());\
117
- if ((expected) && !validator.IsValid()) {\
118
- StringBuffer sb;\
119
- validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);\
120
- printf("Invalid schema: %s\n", sb.GetString());\
121
- printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());\
122
- sb.Clear();\
123
- validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);\
124
- printf("Invalid document: %s\n", sb.GetString());\
125
- sb.Clear();\
126
- Writer<StringBuffer> w(sb);\
127
- validator.GetError().Accept(w);\
128
- printf("Validation error: %s\n", sb.GetString());\
129
- }\
130
- }
131
-
132
- #define INVALIDATE(schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer, error) \
133
- {\
134
- INVALIDATE_(schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer, error, SchemaValidator, Pointer) \
135
- }
136
-
137
- #define INVALIDATE_(schema, json, invalidSchemaPointer, invalidSchemaKeyword, invalidDocumentPointer, error, \
138
- SchemaValidatorType, PointerType) \
139
- {\
140
- SchemaValidatorType validator(schema);\
141
- Document d;\
142
- /*printf("\n%s\n", json);*/\
143
- d.Parse(json);\
144
- EXPECT_FALSE(d.HasParseError());\
145
- EXPECT_FALSE(d.Accept(validator));\
146
- EXPECT_FALSE(validator.IsValid());\
147
- if (validator.GetInvalidSchemaPointer() != PointerType(invalidSchemaPointer)) {\
148
- StringBuffer sb;\
149
- validator.GetInvalidSchemaPointer().Stringify(sb);\
150
- printf("GetInvalidSchemaPointer() Expected: %s Actual: %s\n", invalidSchemaPointer, sb.GetString());\
151
- ADD_FAILURE();\
152
- }\
153
- ASSERT_TRUE(validator.GetInvalidSchemaKeyword() != 0);\
154
- if (strcmp(validator.GetInvalidSchemaKeyword(), invalidSchemaKeyword) != 0) {\
155
- printf("GetInvalidSchemaKeyword() Expected: %s Actual %s\n", invalidSchemaKeyword, validator.GetInvalidSchemaKeyword());\
156
- ADD_FAILURE();\
157
- }\
158
- if (validator.GetInvalidDocumentPointer() != PointerType(invalidDocumentPointer)) {\
159
- StringBuffer sb;\
160
- validator.GetInvalidDocumentPointer().Stringify(sb);\
161
- printf("GetInvalidDocumentPointer() Expected: %s Actual: %s\n", invalidDocumentPointer, sb.GetString());\
162
- ADD_FAILURE();\
163
- }\
164
- Document e;\
165
- e.Parse(error);\
166
- if (validator.GetError() != e) {\
167
- StringBuffer sb;\
168
- Writer<StringBuffer> w(sb);\
169
- validator.GetError().Accept(w);\
170
- printf("GetError() Expected: %s Actual: %s\n", error, sb.GetString());\
171
- ADD_FAILURE();\
172
- }\
173
- }
174
-
175
- TEST(SchemaValidator, Typeless) {
176
- Document sd;
177
- sd.Parse("{}");
178
- SchemaDocument s(sd);
179
-
180
- VALIDATE(s, "42", true);
181
- VALIDATE(s, "\"I'm a string\"", true);
182
- VALIDATE(s, "{ \"an\": [ \"arbitrarily\", \"nested\" ], \"data\": \"structure\" }", true);
183
- }
184
-
185
- TEST(SchemaValidator, MultiType) {
186
- Document sd;
187
- sd.Parse("{ \"type\": [\"number\", \"string\"] }");
188
- SchemaDocument s(sd);
189
-
190
- VALIDATE(s, "42", true);
191
- VALIDATE(s, "\"Life, the universe, and everything\"", true);
192
- INVALIDATE(s, "[\"Life\", \"the universe\", \"and everything\"]", "", "type", "",
193
- "{ \"type\": {"
194
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
195
- " \"expected\": [\"string\", \"number\"], \"actual\": \"array\""
196
- "}}");
197
- }
198
-
199
- TEST(SchemaValidator, Enum_Typed) {
200
- Document sd;
201
- sd.Parse("{ \"type\": \"string\", \"enum\" : [\"red\", \"amber\", \"green\"] }");
202
- SchemaDocument s(sd);
203
-
204
- VALIDATE(s, "\"red\"", true);
205
- INVALIDATE(s, "\"blue\"", "", "enum", "",
206
- "{ \"enum\": { \"instanceRef\": \"#\", \"schemaRef\": \"#\" }}");
207
- }
208
-
209
- TEST(SchemaValidator, Enum_Typless) {
210
- Document sd;
211
- sd.Parse("{ \"enum\": [\"red\", \"amber\", \"green\", null, 42] }");
212
- SchemaDocument s(sd);
213
-
214
- VALIDATE(s, "\"red\"", true);
215
- VALIDATE(s, "null", true);
216
- VALIDATE(s, "42", true);
217
- INVALIDATE(s, "0", "", "enum", "",
218
- "{ \"enum\": { \"instanceRef\": \"#\", \"schemaRef\": \"#\" }}");
219
- }
220
-
221
- TEST(SchemaValidator, Enum_InvalidType) {
222
- Document sd;
223
- sd.Parse("{ \"type\": \"string\", \"enum\": [\"red\", \"amber\", \"green\", null] }");
224
- SchemaDocument s(sd);
225
-
226
- VALIDATE(s, "\"red\"", true);
227
- INVALIDATE(s, "null", "", "type", "",
228
- "{ \"type\": {"
229
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
230
- " \"expected\": [\"string\"], \"actual\": \"null\""
231
- "}}");
232
- }
233
-
234
- TEST(SchemaValidator, AllOf) {
235
- {
236
- Document sd;
237
- sd.Parse("{\"allOf\": [{ \"type\": \"string\" }, { \"type\": \"string\", \"maxLength\": 5 }]}");
238
- SchemaDocument s(sd);
239
-
240
- VALIDATE(s, "\"ok\"", true);
241
- INVALIDATE(s, "\"too long\"", "", "allOf", "",
242
- "{ \"maxLength\": { "
243
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/1\", "
244
- " \"expected\": 5, \"actual\": \"too long\""
245
- "}}");
246
- }
247
- {
248
- Document sd;
249
- sd.Parse("{\"allOf\": [{ \"type\": \"string\" }, { \"type\": \"number\" } ] }");
250
- SchemaDocument s(sd);
251
-
252
- VALIDATE(s, "\"No way\"", false);
253
- INVALIDATE(s, "-1", "", "allOf", "",
254
- "{ \"type\": { \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/0\","
255
- " \"expected\": [\"string\"], \"actual\": \"integer\""
256
- "}}");
257
- }
258
- }
259
-
260
- TEST(SchemaValidator, AnyOf) {
261
- Document sd;
262
- sd.Parse("{\"anyOf\": [{ \"type\": \"string\" }, { \"type\": \"number\" } ] }");
263
- SchemaDocument s(sd);
264
-
265
- VALIDATE(s, "\"Yes\"", true);
266
- VALIDATE(s, "42", true);
267
- INVALIDATE(s, "{ \"Not a\": \"string or number\" }", "", "anyOf", "",
268
- "{ \"anyOf\": {"
269
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\", "
270
- " \"errors\": ["
271
- " { \"type\": {"
272
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/anyOf/0\","
273
- " \"expected\": [\"string\"], \"actual\": \"object\""
274
- " }},"
275
- " { \"type\": {"
276
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/anyOf/1\","
277
- " \"expected\": [\"number\"], \"actual\": \"object\""
278
- " }}"
279
- " ]"
280
- "}}");
281
- }
282
-
283
- TEST(SchemaValidator, OneOf) {
284
- Document sd;
285
- sd.Parse("{\"oneOf\": [{ \"type\": \"number\", \"multipleOf\": 5 }, { \"type\": \"number\", \"multipleOf\": 3 } ] }");
286
- SchemaDocument s(sd);
287
-
288
- VALIDATE(s, "10", true);
289
- VALIDATE(s, "9", true);
290
- INVALIDATE(s, "2", "", "oneOf", "",
291
- "{ \"oneOf\": {"
292
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
293
- " \"errors\": ["
294
- " { \"multipleOf\": {"
295
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/oneOf/0\","
296
- " \"expected\": 5, \"actual\": 2"
297
- " }},"
298
- " { \"multipleOf\": {"
299
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/oneOf/1\","
300
- " \"expected\": 3, \"actual\": 2"
301
- " }}"
302
- " ]"
303
- "}}");
304
- INVALIDATE(s, "15", "", "oneOf", "",
305
- "{ \"oneOf\": { \"instanceRef\": \"#\", \"schemaRef\": \"#\", \"errors\": [{}, {}]}}");
306
- }
307
-
308
- TEST(SchemaValidator, Not) {
309
- Document sd;
310
- sd.Parse("{\"not\":{ \"type\": \"string\"}}");
311
- SchemaDocument s(sd);
312
-
313
- VALIDATE(s, "42", true);
314
- VALIDATE(s, "{ \"key\": \"value\" }", true);
315
- INVALIDATE(s, "\"I am a string\"", "", "not", "",
316
- "{ \"not\": { \"instanceRef\": \"#\", \"schemaRef\": \"#\" }}");
317
- }
318
-
319
- TEST(SchemaValidator, Ref) {
320
- Document sd;
321
- sd.Parse(
322
- "{"
323
- " \"$schema\": \"http://json-schema.org/draft-04/schema#\","
324
- ""
325
- " \"definitions\": {"
326
- " \"address\": {"
327
- " \"type\": \"object\","
328
- " \"properties\": {"
329
- " \"street_address\": { \"type\": \"string\" },"
330
- " \"city\": { \"type\": \"string\" },"
331
- " \"state\": { \"type\": \"string\" }"
332
- " },"
333
- " \"required\": [\"street_address\", \"city\", \"state\"]"
334
- " }"
335
- " },"
336
- " \"type\": \"object\","
337
- " \"properties\": {"
338
- " \"billing_address\": { \"$ref\": \"#/definitions/address\" },"
339
- " \"shipping_address\": { \"$ref\": \"#/definitions/address\" }"
340
- " }"
341
- "}");
342
- SchemaDocument s(sd);
343
-
344
- VALIDATE(s, "{\"shipping_address\": {\"street_address\": \"1600 Pennsylvania Avenue NW\", \"city\": \"Washington\", \"state\": \"DC\"}, \"billing_address\": {\"street_address\": \"1st Street SE\", \"city\": \"Washington\", \"state\": \"DC\"} }", true);
345
- }
346
-
347
- TEST(SchemaValidator, Ref_AllOf) {
348
- Document sd;
349
- sd.Parse(
350
- "{"
351
- " \"$schema\": \"http://json-schema.org/draft-04/schema#\","
352
- ""
353
- " \"definitions\": {"
354
- " \"address\": {"
355
- " \"type\": \"object\","
356
- " \"properties\": {"
357
- " \"street_address\": { \"type\": \"string\" },"
358
- " \"city\": { \"type\": \"string\" },"
359
- " \"state\": { \"type\": \"string\" }"
360
- " },"
361
- " \"required\": [\"street_address\", \"city\", \"state\"]"
362
- " }"
363
- " },"
364
- " \"type\": \"object\","
365
- " \"properties\": {"
366
- " \"billing_address\": { \"$ref\": \"#/definitions/address\" },"
367
- " \"shipping_address\": {"
368
- " \"allOf\": ["
369
- " { \"$ref\": \"#/definitions/address\" },"
370
- " { \"properties\":"
371
- " { \"type\": { \"enum\": [ \"residential\", \"business\" ] } },"
372
- " \"required\": [\"type\"]"
373
- " }"
374
- " ]"
375
- " }"
376
- " }"
377
- "}");
378
- SchemaDocument s(sd);
379
-
380
- INVALIDATE(s, "{\"shipping_address\": {\"street_address\": \"1600 Pennsylvania Avenue NW\", \"city\": \"Washington\", \"state\": \"DC\"} }", "/properties/shipping_address", "allOf", "/shipping_address",
381
- "{ \"required\": {"
382
- " \"instanceRef\": \"#/shipping_address\","
383
- " \"schemaRef\": \"#/properties/shipping_address/allOf/1\","
384
- " \"missing\": [\"type\"]"
385
- "}}");
386
- VALIDATE(s, "{\"shipping_address\": {\"street_address\": \"1600 Pennsylvania Avenue NW\", \"city\": \"Washington\", \"state\": \"DC\", \"type\": \"business\"} }", true);
387
- }
388
-
389
- TEST(SchemaValidator, String) {
390
- Document sd;
391
- sd.Parse("{\"type\":\"string\"}");
392
- SchemaDocument s(sd);
393
-
394
- VALIDATE(s, "\"I'm a string\"", true);
395
- INVALIDATE(s, "42", "", "type", "",
396
- "{ \"type\": {"
397
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
398
- " \"expected\": [\"string\"], \"actual\": \"integer\""
399
- "}}");
400
- INVALIDATE(s, "2147483648", "", "type", "",
401
- "{ \"type\": {"
402
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
403
- " \"expected\": [\"string\"], \"actual\": \"integer\""
404
- "}}"); // 2^31 can only be fit in unsigned
405
- INVALIDATE(s, "-2147483649", "", "type", "",
406
- "{ \"type\": {"
407
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
408
- " \"expected\": [\"string\"], \"actual\": \"integer\""
409
- "}}"); // -2^31 - 1 can only be fit in int64_t
410
- INVALIDATE(s, "4294967296", "", "type", "",
411
- "{ \"type\": {"
412
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
413
- " \"expected\": [\"string\"], \"actual\": \"integer\""
414
- "}}"); // 2^32 can only be fit in int64_t
415
- INVALIDATE(s, "3.1415926", "", "type", "",
416
- "{ \"type\": {"
417
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
418
- " \"expected\": [\"string\"], \"actual\": \"number\""
419
- "}}");
420
- }
421
-
422
- TEST(SchemaValidator, String_LengthRange) {
423
- Document sd;
424
- sd.Parse("{\"type\":\"string\",\"minLength\":2,\"maxLength\":3}");
425
- SchemaDocument s(sd);
426
-
427
- INVALIDATE(s, "\"A\"", "", "minLength", "",
428
- "{ \"minLength\": {"
429
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
430
- " \"expected\": 2, \"actual\": \"A\""
431
- "}}");
432
- VALIDATE(s, "\"AB\"", true);
433
- VALIDATE(s, "\"ABC\"", true);
434
- INVALIDATE(s, "\"ABCD\"", "", "maxLength", "",
435
- "{ \"maxLength\": {"
436
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
437
- " \"expected\": 3, \"actual\": \"ABCD\""
438
- "}}");
439
- }
440
-
441
- #if RAPIDJSON_SCHEMA_HAS_REGEX
442
- TEST(SchemaValidator, String_Pattern) {
443
- Document sd;
444
- sd.Parse("{\"type\":\"string\",\"pattern\":\"^(\\\\([0-9]{3}\\\\))?[0-9]{3}-[0-9]{4}$\"}");
445
- SchemaDocument s(sd);
446
-
447
- VALIDATE(s, "\"555-1212\"", true);
448
- VALIDATE(s, "\"(888)555-1212\"", true);
449
- INVALIDATE(s, "\"(888)555-1212 ext. 532\"", "", "pattern", "",
450
- "{ \"pattern\": {"
451
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
452
- " \"actual\": \"(888)555-1212 ext. 532\""
453
- "}}");
454
- INVALIDATE(s, "\"(800)FLOWERS\"", "", "pattern", "",
455
- "{ \"pattern\": {"
456
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
457
- " \"actual\": \"(800)FLOWERS\""
458
- "}}");
459
- }
460
-
461
- TEST(SchemaValidator, String_Pattern_Invalid) {
462
- Document sd;
463
- sd.Parse("{\"type\":\"string\",\"pattern\":\"a{0}\"}"); // TODO: report regex is invalid somehow
464
- SchemaDocument s(sd);
465
-
466
- VALIDATE(s, "\"\"", true);
467
- VALIDATE(s, "\"a\"", true);
468
- VALIDATE(s, "\"aa\"", true);
469
- }
470
- #endif
471
-
472
- TEST(SchemaValidator, Integer) {
473
- Document sd;
474
- sd.Parse("{\"type\":\"integer\"}");
475
- SchemaDocument s(sd);
476
-
477
- VALIDATE(s, "42", true);
478
- VALIDATE(s, "-1", true);
479
- VALIDATE(s, "2147483648", true); // 2^31 can only be fit in unsigned
480
- VALIDATE(s, "-2147483649", true); // -2^31 - 1 can only be fit in int64_t
481
- VALIDATE(s, "2147483648", true); // 2^31 can only be fit in unsigned
482
- VALIDATE(s, "4294967296", true); // 2^32 can only be fit in int64_t
483
- INVALIDATE(s, "3.1415926", "", "type", "",
484
- "{ \"type\": {"
485
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
486
- " \"expected\": [\"integer\"], \"actual\": \"number\""
487
- "}}");
488
- INVALIDATE(s, "\"42\"", "", "type", "",
489
- "{ \"type\": {"
490
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
491
- " \"expected\": [\"integer\"], \"actual\": \"string\""
492
- "}}");
493
- }
494
-
495
- TEST(SchemaValidator, Integer_Range) {
496
- Document sd;
497
- sd.Parse("{\"type\":\"integer\",\"minimum\":0,\"maximum\":100,\"exclusiveMaximum\":true}");
498
- SchemaDocument s(sd);
499
-
500
- INVALIDATE(s, "-1", "", "minimum", "",
501
- "{ \"minimum\": {"
502
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
503
- " \"expected\": 0, \"actual\": -1"
504
- "}}");
505
- VALIDATE(s, "0", true);
506
- VALIDATE(s, "10", true);
507
- VALIDATE(s, "99", true);
508
- INVALIDATE(s, "100", "", "maximum", "",
509
- "{ \"maximum\": {"
510
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
511
- " \"expected\": 100, \"exclusiveMaximum\": true, \"actual\": 100"
512
- "}}");
513
- INVALIDATE(s, "101", "", "maximum", "",
514
- "{ \"maximum\": {"
515
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
516
- " \"expected\": 100, \"exclusiveMaximum\": true, \"actual\": 101"
517
- "}}");
518
- }
519
-
520
- TEST(SchemaValidator, Integer_Range64Boundary) {
521
- Document sd;
522
- sd.Parse("{\"type\":\"integer\",\"minimum\":-9223372036854775807,\"maximum\":9223372036854775806}");
523
- SchemaDocument s(sd);
524
-
525
- INVALIDATE(s, "-9223372036854775808", "", "minimum", "",
526
- "{ \"minimum\": {"
527
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
528
- " \"expected\": -9223372036854775807, \"actual\": -9223372036854775808"
529
- "}}");
530
- VALIDATE(s, "-9223372036854775807", true);
531
- VALIDATE(s, "-2147483648", true); // int min
532
- VALIDATE(s, "0", true);
533
- VALIDATE(s, "2147483647", true); // int max
534
- VALIDATE(s, "2147483648", true); // unsigned first
535
- VALIDATE(s, "4294967295", true); // unsigned max
536
- VALIDATE(s, "9223372036854775806", true);
537
- INVALIDATE(s, "9223372036854775807", "", "maximum", "",
538
- "{ \"maximum\": {"
539
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
540
- " \"expected\": 9223372036854775806, \"actual\": 9223372036854775807"
541
- "}}");
542
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
543
- "{ \"maximum\": {"
544
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
545
- " \"expected\": 9223372036854775806, \"actual\": 18446744073709551615"
546
- "}}"); // uint64_t max
547
- }
548
-
549
- TEST(SchemaValidator, Integer_RangeU64Boundary) {
550
- Document sd;
551
- sd.Parse("{\"type\":\"integer\",\"minimum\":9223372036854775808,\"maximum\":18446744073709551614}");
552
- SchemaDocument s(sd);
553
-
554
- INVALIDATE(s, "-9223372036854775808", "", "minimum", "",
555
- "{ \"minimum\": {"
556
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
557
- " \"expected\": 9223372036854775808, \"actual\": -9223372036854775808"
558
- "}}");
559
- INVALIDATE(s, "9223372036854775807", "", "minimum", "",
560
- "{ \"minimum\": {"
561
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
562
- " \"expected\": 9223372036854775808, \"actual\": 9223372036854775807"
563
- "}}");
564
- INVALIDATE(s, "-2147483648", "", "minimum", "",
565
- "{ \"minimum\": {"
566
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
567
- " \"expected\": 9223372036854775808, \"actual\": -2147483648"
568
- "}}"); // int min
569
- INVALIDATE(s, "0", "", "minimum", "",
570
- "{ \"minimum\": {"
571
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
572
- " \"expected\": 9223372036854775808, \"actual\": 0"
573
- "}}");
574
- INVALIDATE(s, "2147483647", "", "minimum", "",
575
- "{ \"minimum\": {"
576
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
577
- " \"expected\": 9223372036854775808, \"actual\": 2147483647"
578
- "}}"); // int max
579
- INVALIDATE(s, "2147483648", "", "minimum", "",
580
- "{ \"minimum\": {"
581
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
582
- " \"expected\": 9223372036854775808, \"actual\": 2147483648"
583
- "}}"); // unsigned first
584
- INVALIDATE(s, "4294967295", "", "minimum", "",
585
- "{ \"minimum\": {"
586
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
587
- " \"expected\": 9223372036854775808, \"actual\": 4294967295"
588
- "}}"); // unsigned max
589
- VALIDATE(s, "9223372036854775808", true);
590
- VALIDATE(s, "18446744073709551614", true);
591
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
592
- "{ \"maximum\": {"
593
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
594
- " \"expected\": 18446744073709551614, \"actual\": 18446744073709551615"
595
- "}}");
596
- }
597
-
598
- TEST(SchemaValidator, Integer_Range64BoundaryExclusive) {
599
- Document sd;
600
- sd.Parse("{\"type\":\"integer\",\"minimum\":-9223372036854775808,\"maximum\":18446744073709551615,\"exclusiveMinimum\":true,\"exclusiveMaximum\":true}");
601
- SchemaDocument s(sd);
602
-
603
- INVALIDATE(s, "-9223372036854775808", "", "minimum", "",
604
- "{ \"minimum\": {"
605
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
606
- " \"expected\": -9223372036854775808, \"exclusiveMinimum\": true, "
607
- " \"actual\": -9223372036854775808"
608
- "}}");
609
- VALIDATE(s, "-9223372036854775807", true);
610
- VALIDATE(s, "18446744073709551614", true);
611
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
612
- "{ \"maximum\": {"
613
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
614
- " \"expected\": 18446744073709551615, \"exclusiveMaximum\": true, "
615
- " \"actual\": 18446744073709551615"
616
- "}}");
617
- }
618
-
619
- TEST(SchemaValidator, Integer_MultipleOf) {
620
- Document sd;
621
- sd.Parse("{\"type\":\"integer\",\"multipleOf\":10}");
622
- SchemaDocument s(sd);
623
-
624
- VALIDATE(s, "0", true);
625
- VALIDATE(s, "10", true);
626
- VALIDATE(s, "-10", true);
627
- VALIDATE(s, "20", true);
628
- INVALIDATE(s, "23", "", "multipleOf", "",
629
- "{ \"multipleOf\": {"
630
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
631
- " \"expected\": 10, \"actual\": 23"
632
- "}}");
633
- INVALIDATE(s, "-23", "", "multipleOf", "",
634
- "{ \"multipleOf\": {"
635
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
636
- " \"expected\": 10, \"actual\": -23"
637
- "}}");
638
- }
639
-
640
- TEST(SchemaValidator, Integer_MultipleOf64Boundary) {
641
- Document sd;
642
- sd.Parse("{\"type\":\"integer\",\"multipleOf\":18446744073709551615}");
643
- SchemaDocument s(sd);
644
-
645
- VALIDATE(s, "0", true);
646
- VALIDATE(s, "18446744073709551615", true);
647
- INVALIDATE(s, "18446744073709551614", "", "multipleOf", "",
648
- "{ \"multipleOf\": {"
649
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
650
- " \"expected\": 18446744073709551615, \"actual\": 18446744073709551614"
651
- "}}");
652
- }
653
-
654
- TEST(SchemaValidator, Number_Range) {
655
- Document sd;
656
- sd.Parse("{\"type\":\"number\",\"minimum\":0,\"maximum\":100,\"exclusiveMaximum\":true}");
657
- SchemaDocument s(sd);
658
-
659
- INVALIDATE(s, "-1", "", "minimum", "",
660
- "{ \"minimum\": {"
661
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
662
- " \"expected\": 0, \"actual\": -1"
663
- "}}");
664
- VALIDATE(s, "0", true);
665
- VALIDATE(s, "0.1", true);
666
- VALIDATE(s, "10", true);
667
- VALIDATE(s, "99", true);
668
- VALIDATE(s, "99.9", true);
669
- INVALIDATE(s, "100", "", "maximum", "",
670
- "{ \"maximum\": {"
671
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
672
- " \"expected\": 100, \"exclusiveMaximum\": true, \"actual\": 100"
673
- "}}");
674
- INVALIDATE(s, "100.0", "", "maximum", "",
675
- "{ \"maximum\": {"
676
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
677
- " \"expected\": 100, \"exclusiveMaximum\": true, \"actual\": 100.0"
678
- "}}");
679
- INVALIDATE(s, "101.5", "", "maximum", "",
680
- "{ \"maximum\": {"
681
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
682
- " \"expected\": 100, \"exclusiveMaximum\": true, \"actual\": 101.5"
683
- "}}");
684
- }
685
-
686
- TEST(SchemaValidator, Number_RangeInt) {
687
- Document sd;
688
- sd.Parse("{\"type\":\"number\",\"minimum\":-100,\"maximum\":-1,\"exclusiveMaximum\":true}");
689
- SchemaDocument s(sd);
690
-
691
- INVALIDATE(s, "-101", "", "minimum", "",
692
- "{ \"minimum\": {"
693
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
694
- " \"expected\": -100, \"actual\": -101"
695
- "}}");
696
- INVALIDATE(s, "-100.1", "", "minimum", "",
697
- "{ \"minimum\": {"
698
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
699
- " \"expected\": -100, \"actual\": -100.1"
700
- "}}");
701
- VALIDATE(s, "-100", true);
702
- VALIDATE(s, "-2", true);
703
- INVALIDATE(s, "-1", "", "maximum", "",
704
- "{ \"maximum\": {"
705
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
706
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": -1"
707
- "}}");
708
- INVALIDATE(s, "-0.9", "", "maximum", "",
709
- "{ \"maximum\": {"
710
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
711
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": -0.9"
712
- "}}");
713
- INVALIDATE(s, "0", "", "maximum", "",
714
- "{ \"maximum\": {"
715
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
716
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 0"
717
- "}}");
718
- INVALIDATE(s, "2147483647", "", "maximum", "",
719
- "{ \"maximum\": {"
720
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
721
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 2147483647"
722
- "}}"); // int max
723
- INVALIDATE(s, "2147483648", "", "maximum", "",
724
- "{ \"maximum\": {"
725
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
726
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 2147483648"
727
- "}}"); // unsigned first
728
- INVALIDATE(s, "4294967295", "", "maximum", "",
729
- "{ \"maximum\": {"
730
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
731
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 4294967295"
732
- "}}"); // unsigned max
733
- INVALIDATE(s, "9223372036854775808", "", "maximum", "",
734
- "{ \"maximum\": {"
735
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
736
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 9223372036854775808"
737
- "}}");
738
- INVALIDATE(s, "18446744073709551614", "", "maximum", "",
739
- "{ \"maximum\": {"
740
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
741
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551614"
742
- "}}");
743
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
744
- "{ \"maximum\": {"
745
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
746
- " \"expected\": -1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551615"
747
- "}}");
748
- }
749
-
750
- TEST(SchemaValidator, Number_RangeDouble) {
751
- Document sd;
752
- sd.Parse("{\"type\":\"number\",\"minimum\":0.1,\"maximum\":100.1,\"exclusiveMaximum\":true}");
753
- SchemaDocument s(sd);
754
-
755
- INVALIDATE(s, "-9223372036854775808", "", "minimum", "",
756
- "{ \"minimum\": {"
757
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
758
- " \"expected\": 0.1, \"actual\": -9223372036854775808"
759
- "}}");
760
- INVALIDATE(s, "-2147483648", "", "minimum", "",
761
- "{ \"minimum\": {"
762
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
763
- " \"expected\": 0.1, \"actual\": -2147483648"
764
- "}}"); // int min
765
- INVALIDATE(s, "-1", "", "minimum", "",
766
- "{ \"minimum\": {"
767
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
768
- " \"expected\": 0.1, \"actual\": -1"
769
- "}}");
770
- VALIDATE(s, "0.1", true);
771
- VALIDATE(s, "10", true);
772
- VALIDATE(s, "99", true);
773
- VALIDATE(s, "100", true);
774
- INVALIDATE(s, "101", "", "maximum", "",
775
- "{ \"maximum\": {"
776
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
777
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 101"
778
- "}}");
779
- INVALIDATE(s, "101.5", "", "maximum", "",
780
- "{ \"maximum\": {"
781
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
782
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 101.5"
783
- "}}");
784
- INVALIDATE(s, "18446744073709551614", "", "maximum", "",
785
- "{ \"maximum\": {"
786
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
787
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551614"
788
- "}}");
789
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
790
- "{ \"maximum\": {"
791
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
792
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551615"
793
- "}}");
794
- INVALIDATE(s, "2147483647", "", "maximum", "",
795
- "{ \"maximum\": {"
796
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
797
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 2147483647"
798
- "}}"); // int max
799
- INVALIDATE(s, "2147483648", "", "maximum", "",
800
- "{ \"maximum\": {"
801
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
802
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 2147483648"
803
- "}}"); // unsigned first
804
- INVALIDATE(s, "4294967295", "", "maximum", "",
805
- "{ \"maximum\": {"
806
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
807
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 4294967295"
808
- "}}"); // unsigned max
809
- INVALIDATE(s, "9223372036854775808", "", "maximum", "",
810
- "{ \"maximum\": {"
811
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
812
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 9223372036854775808"
813
- "}}");
814
- INVALIDATE(s, "18446744073709551614", "", "maximum", "",
815
- "{ \"maximum\": {"
816
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
817
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551614"
818
- "}}");
819
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
820
- "{ \"maximum\": {"
821
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
822
- " \"expected\": 100.1, \"exclusiveMaximum\": true, \"actual\": 18446744073709551615"
823
- "}}");
824
- }
825
-
826
- TEST(SchemaValidator, Number_RangeDoubleU64Boundary) {
827
- Document sd;
828
- sd.Parse("{\"type\":\"number\",\"minimum\":9223372036854775808.0,\"maximum\":18446744073709550000.0}");
829
- SchemaDocument s(sd);
830
-
831
- INVALIDATE(s, "-9223372036854775808", "", "minimum", "",
832
- "{ \"minimum\": {"
833
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
834
- " \"expected\": 9223372036854775808.0, \"actual\": -9223372036854775808"
835
- "}}");
836
- INVALIDATE(s, "-2147483648", "", "minimum", "",
837
- "{ \"minimum\": {"
838
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
839
- " \"expected\": 9223372036854775808.0, \"actual\": -2147483648"
840
- "}}"); // int min
841
- INVALIDATE(s, "0", "", "minimum", "",
842
- "{ \"minimum\": {"
843
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
844
- " \"expected\": 9223372036854775808.0, \"actual\": 0"
845
- "}}");
846
- INVALIDATE(s, "2147483647", "", "minimum", "",
847
- "{ \"minimum\": {"
848
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
849
- " \"expected\": 9223372036854775808.0, \"actual\": 2147483647"
850
- "}}"); // int max
851
- INVALIDATE(s, "2147483648", "", "minimum", "",
852
- "{ \"minimum\": {"
853
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
854
- " \"expected\": 9223372036854775808.0, \"actual\": 2147483648"
855
- "}}"); // unsigned first
856
- INVALIDATE(s, "4294967295", "", "minimum", "",
857
- "{ \"minimum\": {"
858
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
859
- " \"expected\": 9223372036854775808.0, \"actual\": 4294967295"
860
- "}}"); // unsigned max
861
- VALIDATE(s, "9223372036854775808", true);
862
- VALIDATE(s, "18446744073709540000", true);
863
- INVALIDATE(s, "18446744073709551615", "", "maximum", "",
864
- "{ \"maximum\": {"
865
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
866
- " \"expected\": 18446744073709550000.0, \"actual\": 18446744073709551615"
867
- "}}");
868
- }
869
-
870
- TEST(SchemaValidator, Number_MultipleOf) {
871
- Document sd;
872
- sd.Parse("{\"type\":\"number\",\"multipleOf\":10.0}");
873
- SchemaDocument s(sd);
874
-
875
- VALIDATE(s, "0", true);
876
- VALIDATE(s, "10", true);
877
- VALIDATE(s, "-10", true);
878
- VALIDATE(s, "20", true);
879
- INVALIDATE(s, "23", "", "multipleOf", "",
880
- "{ \"multipleOf\": {"
881
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
882
- " \"expected\": 10.0, \"actual\": 23"
883
- "}}");
884
- INVALIDATE(s, "-2147483648", "", "multipleOf", "",
885
- "{ \"multipleOf\": {"
886
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
887
- " \"expected\": 10.0, \"actual\": -2147483648"
888
- "}}"); // int min
889
- VALIDATE(s, "-2147483640", true);
890
- INVALIDATE(s, "2147483647", "", "multipleOf", "",
891
- "{ \"multipleOf\": {"
892
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
893
- " \"expected\": 10.0, \"actual\": 2147483647"
894
- "}}"); // int max
895
- INVALIDATE(s, "2147483648", "", "multipleOf", "",
896
- "{ \"multipleOf\": {"
897
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
898
- " \"expected\": 10.0, \"actual\": 2147483648"
899
- "}}"); // unsigned first
900
- VALIDATE(s, "2147483650", true);
901
- INVALIDATE(s, "4294967295", "", "multipleOf", "",
902
- "{ \"multipleOf\": {"
903
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
904
- " \"expected\": 10.0, \"actual\": 4294967295"
905
- "}}"); // unsigned max
906
- VALIDATE(s, "4294967300", true);
907
- }
908
-
909
- TEST(SchemaValidator, Number_MultipleOfOne) {
910
- Document sd;
911
- sd.Parse("{\"type\":\"number\",\"multipleOf\":1}");
912
- SchemaDocument s(sd);
913
-
914
- VALIDATE(s, "42", true);
915
- VALIDATE(s, "42.0", true);
916
- INVALIDATE(s, "3.1415926", "", "multipleOf", "",
917
- "{ \"multipleOf\": {"
918
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
919
- " \"expected\": 1, \"actual\": 3.1415926"
920
- "}}");
921
- }
922
-
923
- TEST(SchemaValidator, Object) {
924
- Document sd;
925
- sd.Parse("{\"type\":\"object\"}");
926
- SchemaDocument s(sd);
927
-
928
- VALIDATE(s, "{\"key\":\"value\",\"another_key\":\"another_value\"}", true);
929
- VALIDATE(s, "{\"Sun\":1.9891e30,\"Jupiter\":1.8986e27,\"Saturn\":5.6846e26,\"Neptune\":10.243e25,\"Uranus\":8.6810e25,\"Earth\":5.9736e24,\"Venus\":4.8685e24,\"Mars\":6.4185e23,\"Mercury\":3.3022e23,\"Moon\":7.349e22,\"Pluto\":1.25e22}", true);
930
- INVALIDATE(s, "[\"An\", \"array\", \"not\", \"an\", \"object\"]", "", "type", "",
931
- "{ \"type\": {"
932
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
933
- " \"expected\": [\"object\"], \"actual\": \"array\""
934
- "}}");
935
- INVALIDATE(s, "\"Not an object\"", "", "type", "",
936
- "{ \"type\": {"
937
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
938
- " \"expected\": [\"object\"], \"actual\": \"string\""
939
- "}}");
940
- }
941
-
942
- TEST(SchemaValidator, Object_Properties) {
943
- Document sd;
944
- sd.Parse(
945
- "{"
946
- " \"type\": \"object\","
947
- " \"properties\" : {"
948
- " \"number\": { \"type\": \"number\" },"
949
- " \"street_name\" : { \"type\": \"string\" },"
950
- " \"street_type\" : { \"type\": \"string\", \"enum\" : [\"Street\", \"Avenue\", \"Boulevard\"] }"
951
- " }"
952
- "}");
953
-
954
- SchemaDocument s(sd);
955
-
956
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\" }", true);
957
- INVALIDATE(s, "{ \"number\": \"1600\", \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\" }", "/properties/number", "type", "/number",
958
- "{ \"type\": {"
959
- " \"instanceRef\": \"#/number\", \"schemaRef\": \"#/properties/number\","
960
- " \"expected\": [\"number\"], \"actual\": \"string\""
961
- "}}");
962
- INVALIDATE(s, "{ \"number\": \"One\", \"street_name\": \"Microsoft\", \"street_type\": \"Way\" }",
963
- "/properties/number", "type", "/number",
964
- "{ \"type\": {"
965
- " \"instanceRef\": \"#/number\", \"schemaRef\": \"#/properties/number\","
966
- " \"expected\": [\"number\"], \"actual\": \"string\""
967
- "}}"); // fail fast
968
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\" }", true);
969
- VALIDATE(s, "{}", true);
970
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\", \"direction\": \"NW\" }", true);
971
- }
972
-
973
- TEST(SchemaValidator, Object_AdditionalPropertiesBoolean) {
974
- Document sd;
975
- sd.Parse(
976
- "{"
977
- " \"type\": \"object\","
978
- " \"properties\" : {"
979
- " \"number\": { \"type\": \"number\" },"
980
- " \"street_name\" : { \"type\": \"string\" },"
981
- " \"street_type\" : { \"type\": \"string\","
982
- " \"enum\" : [\"Street\", \"Avenue\", \"Boulevard\"]"
983
- " }"
984
- " },"
985
- " \"additionalProperties\": false"
986
- "}");
987
-
988
- SchemaDocument s(sd);
989
-
990
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\" }", true);
991
- INVALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\", \"direction\": \"NW\" }", "", "additionalProperties", "/direction",
992
- "{ \"additionalProperties\": {"
993
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
994
- " \"disallowed\": \"direction\""
995
- "}}");
996
- }
997
-
998
- TEST(SchemaValidator, Object_AdditionalPropertiesObject) {
999
- Document sd;
1000
- sd.Parse(
1001
- "{"
1002
- " \"type\": \"object\","
1003
- " \"properties\" : {"
1004
- " \"number\": { \"type\": \"number\" },"
1005
- " \"street_name\" : { \"type\": \"string\" },"
1006
- " \"street_type\" : { \"type\": \"string\","
1007
- " \"enum\" : [\"Street\", \"Avenue\", \"Boulevard\"]"
1008
- " }"
1009
- " },"
1010
- " \"additionalProperties\": { \"type\": \"string\" }"
1011
- "}");
1012
- SchemaDocument s(sd);
1013
-
1014
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\" }", true);
1015
- VALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\", \"direction\": \"NW\" }", true);
1016
- INVALIDATE(s, "{ \"number\": 1600, \"street_name\": \"Pennsylvania\", \"street_type\": \"Avenue\", \"office_number\": 201 }", "/additionalProperties", "type", "/office_number",
1017
- "{ \"type\": {"
1018
- " \"instanceRef\": \"#/office_number\", \"schemaRef\": \"#/additionalProperties\","
1019
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1020
- "}}");
1021
- }
1022
-
1023
- TEST(SchemaValidator, Object_Required) {
1024
- Document sd;
1025
- sd.Parse(
1026
- "{"
1027
- " \"type\": \"object\","
1028
- " \"properties\" : {"
1029
- " \"name\": { \"type\": \"string\" },"
1030
- " \"email\" : { \"type\": \"string\" },"
1031
- " \"address\" : { \"type\": \"string\" },"
1032
- " \"telephone\" : { \"type\": \"string\" }"
1033
- " },"
1034
- " \"required\":[\"name\", \"email\"]"
1035
- "}");
1036
- SchemaDocument s(sd);
1037
-
1038
- VALIDATE(s, "{ \"name\": \"William Shakespeare\", \"email\" : \"bill@stratford-upon-avon.co.uk\" }", true);
1039
- VALIDATE(s, "{ \"name\": \"William Shakespeare\", \"email\" : \"bill@stratford-upon-avon.co.uk\", \"address\" : \"Henley Street, Stratford-upon-Avon, Warwickshire, England\", \"authorship\" : \"in question\"}", true);
1040
- INVALIDATE(s, "{ \"name\": \"William Shakespeare\", \"address\" : \"Henley Street, Stratford-upon-Avon, Warwickshire, England\" }", "", "required", "",
1041
- "{ \"required\": {"
1042
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1043
- " \"missing\": [\"email\"]"
1044
- "}}");
1045
- INVALIDATE(s, "{}", "", "required", "",
1046
- "{ \"required\": {"
1047
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1048
- " \"missing\": [\"name\", \"email\"]"
1049
- "}}");
1050
- }
1051
-
1052
- TEST(SchemaValidator, Object_Required_PassWithDefault) {
1053
- Document sd;
1054
- sd.Parse(
1055
- "{"
1056
- " \"type\": \"object\","
1057
- " \"properties\" : {"
1058
- " \"name\": { \"type\": \"string\", \"default\": \"William Shakespeare\" },"
1059
- " \"email\" : { \"type\": \"string\", \"default\": \"\" },"
1060
- " \"address\" : { \"type\": \"string\" },"
1061
- " \"telephone\" : { \"type\": \"string\" }"
1062
- " },"
1063
- " \"required\":[\"name\", \"email\"]"
1064
- "}");
1065
- SchemaDocument s(sd);
1066
-
1067
- VALIDATE(s, "{ \"email\" : \"bill@stratford-upon-avon.co.uk\", \"address\" : \"Henley Street, Stratford-upon-Avon, Warwickshire, England\", \"authorship\" : \"in question\"}", true);
1068
- INVALIDATE(s, "{ \"name\": \"William Shakespeare\", \"address\" : \"Henley Street, Stratford-upon-Avon, Warwickshire, England\" }", "", "required", "",
1069
- "{ \"required\": {"
1070
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1071
- " \"missing\": [\"email\"]"
1072
- "}}");
1073
- INVALIDATE(s, "{}", "", "required", "",
1074
- "{ \"required\": {"
1075
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1076
- " \"missing\": [\"email\"]"
1077
- "}}");
1078
- }
1079
-
1080
- TEST(SchemaValidator, Object_PropertiesRange) {
1081
- Document sd;
1082
- sd.Parse("{\"type\":\"object\", \"minProperties\":2, \"maxProperties\":3}");
1083
- SchemaDocument s(sd);
1084
-
1085
- INVALIDATE(s, "{}", "", "minProperties", "",
1086
- "{ \"minProperties\": {"
1087
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1088
- " \"expected\": 2, \"actual\": 0"
1089
- "}}");
1090
- INVALIDATE(s, "{\"a\":0}", "", "minProperties", "",
1091
- "{ \"minProperties\": {"
1092
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1093
- " \"expected\": 2, \"actual\": 1"
1094
- "}}");
1095
- VALIDATE(s, "{\"a\":0,\"b\":1}", true);
1096
- VALIDATE(s, "{\"a\":0,\"b\":1,\"c\":2}", true);
1097
- INVALIDATE(s, "{\"a\":0,\"b\":1,\"c\":2,\"d\":3}", "", "maxProperties", "",
1098
- "{ \"maxProperties\": {"
1099
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\", "
1100
- " \"expected\": 3, \"actual\": 4"
1101
- "}}");
1102
- }
1103
-
1104
- TEST(SchemaValidator, Object_PropertyDependencies) {
1105
- Document sd;
1106
- sd.Parse(
1107
- "{"
1108
- " \"type\": \"object\","
1109
- " \"properties\": {"
1110
- " \"name\": { \"type\": \"string\" },"
1111
- " \"credit_card\": { \"type\": \"number\" },"
1112
- " \"cvv_code\": { \"type\": \"number\" },"
1113
- " \"billing_address\": { \"type\": \"string\" }"
1114
- " },"
1115
- " \"required\": [\"name\"],"
1116
- " \"dependencies\": {"
1117
- " \"credit_card\": [\"cvv_code\", \"billing_address\"]"
1118
- " }"
1119
- "}");
1120
- SchemaDocument s(sd);
1121
-
1122
- VALIDATE(s, "{ \"name\": \"John Doe\", \"credit_card\": 5555555555555555, \"cvv_code\": 777, "
1123
- "\"billing_address\": \"555 Debtor's Lane\" }", true);
1124
- INVALIDATE(s, "{ \"name\": \"John Doe\", \"credit_card\": 5555555555555555 }", "", "dependencies", "",
1125
- "{ \"dependencies\": {"
1126
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1127
- " \"errors\": {\"credit_card\": [\"cvv_code\", \"billing_address\"]}"
1128
- "}}");
1129
- VALIDATE(s, "{ \"name\": \"John Doe\"}", true);
1130
- VALIDATE(s, "{ \"name\": \"John Doe\", \"cvv_code\": 777, \"billing_address\": \"555 Debtor's Lane\" }", true);
1131
- }
1132
-
1133
- TEST(SchemaValidator, Object_SchemaDependencies) {
1134
- Document sd;
1135
- sd.Parse(
1136
- "{"
1137
- " \"type\": \"object\","
1138
- " \"properties\" : {"
1139
- " \"name\": { \"type\": \"string\" },"
1140
- " \"credit_card\" : { \"type\": \"number\" }"
1141
- " },"
1142
- " \"required\" : [\"name\"],"
1143
- " \"dependencies\" : {"
1144
- " \"credit_card\": {"
1145
- " \"properties\": {"
1146
- " \"billing_address\": { \"type\": \"string\" }"
1147
- " },"
1148
- " \"required\" : [\"billing_address\"]"
1149
- " }"
1150
- " }"
1151
- "}");
1152
- SchemaDocument s(sd);
1153
-
1154
- VALIDATE(s, "{\"name\": \"John Doe\", \"credit_card\" : 5555555555555555,\"billing_address\" : \"555 Debtor's Lane\"}", true);
1155
- INVALIDATE(s, "{\"name\": \"John Doe\", \"credit_card\" : 5555555555555555 }", "", "dependencies", "",
1156
- "{ \"dependencies\": {"
1157
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1158
- " \"errors\": {"
1159
- " \"credit_card\": {"
1160
- " \"required\": {"
1161
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/dependencies/credit_card\","
1162
- " \"missing\": [\"billing_address\"]"
1163
- " } } }"
1164
- "}}");
1165
- VALIDATE(s, "{\"name\": \"John Doe\", \"billing_address\" : \"555 Debtor's Lane\"}", true);
1166
- }
1167
-
1168
- #if RAPIDJSON_SCHEMA_HAS_REGEX
1169
- TEST(SchemaValidator, Object_PatternProperties) {
1170
- Document sd;
1171
- sd.Parse(
1172
- "{"
1173
- " \"type\": \"object\","
1174
- " \"patternProperties\": {"
1175
- " \"^S_\": { \"type\": \"string\" },"
1176
- " \"^I_\": { \"type\": \"integer\" }"
1177
- " }"
1178
- "}");
1179
- SchemaDocument s(sd);
1180
-
1181
- VALIDATE(s, "{ \"S_25\": \"This is a string\" }", true);
1182
- VALIDATE(s, "{ \"I_0\": 42 }", true);
1183
- INVALIDATE(s, "{ \"S_0\": 42 }", "", "patternProperties", "/S_0",
1184
- "{ \"type\": {"
1185
- " \"instanceRef\": \"#/S_0\", \"schemaRef\": \"#/patternProperties/%5ES_\","
1186
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1187
- "}}");
1188
- INVALIDATE(s, "{ \"I_42\": \"This is a string\" }", "", "patternProperties", "/I_42",
1189
- "{ \"type\": {"
1190
- " \"instanceRef\": \"#/I_42\", \"schemaRef\": \"#/patternProperties/%5EI_\","
1191
- " \"expected\": [\"integer\"], \"actual\": \"string\""
1192
- "}}");
1193
- VALIDATE(s, "{ \"keyword\": \"value\" }", true);
1194
- }
1195
-
1196
- TEST(SchemaValidator, Object_PattternProperties_ErrorConflict) {
1197
- Document sd;
1198
- sd.Parse(
1199
- "{"
1200
- " \"type\": \"object\","
1201
- " \"patternProperties\": {"
1202
- " \"^I_\": { \"multipleOf\": 5 },"
1203
- " \"30$\": { \"multipleOf\": 6 }"
1204
- " }"
1205
- "}");
1206
- SchemaDocument s(sd);
1207
-
1208
- VALIDATE(s, "{ \"I_30\": 30 }", true);
1209
- INVALIDATE(s, "{ \"I_30\": 7 }", "", "patternProperties", "/I_30",
1210
- "{ \"multipleOf\": ["
1211
- " {"
1212
- " \"instanceRef\": \"#/I_30\", \"schemaRef\": \"#/patternProperties/%5EI_\","
1213
- " \"expected\": 5, \"actual\": 7"
1214
- " }, {"
1215
- " \"instanceRef\": \"#/I_30\", \"schemaRef\": \"#/patternProperties/30%24\","
1216
- " \"expected\": 6, \"actual\": 7"
1217
- " }"
1218
- "]}");
1219
- }
1220
-
1221
- TEST(SchemaValidator, Object_Properties_PatternProperties) {
1222
- Document sd;
1223
- sd.Parse(
1224
- "{"
1225
- " \"type\": \"object\","
1226
- " \"properties\": {"
1227
- " \"I_42\": { \"type\": \"integer\", \"minimum\": 73 }"
1228
- " },"
1229
- " \"patternProperties\": {"
1230
- " \"^I_\": { \"type\": \"integer\", \"multipleOf\": 6 }"
1231
- " }"
1232
- "}");
1233
- SchemaDocument s(sd);
1234
-
1235
- VALIDATE(s, "{ \"I_6\": 6 }", true);
1236
- VALIDATE(s, "{ \"I_42\": 78 }", true);
1237
- INVALIDATE(s, "{ \"I_42\": 42 }", "", "patternProperties", "/I_42",
1238
- "{ \"minimum\": {"
1239
- " \"instanceRef\": \"#/I_42\", \"schemaRef\": \"#/properties/I_42\","
1240
- " \"expected\": 73, \"actual\": 42"
1241
- "}}");
1242
- INVALIDATE(s, "{ \"I_42\": 7 }", "", "patternProperties", "/I_42",
1243
- "{ \"minimum\": {"
1244
- " \"instanceRef\": \"#/I_42\", \"schemaRef\": \"#/properties/I_42\","
1245
- " \"expected\": 73, \"actual\": 7"
1246
- " },"
1247
- " \"multipleOf\": {"
1248
- " \"instanceRef\": \"#/I_42\", \"schemaRef\": \"#/patternProperties/%5EI_\","
1249
- " \"expected\": 6, \"actual\": 7"
1250
- " }"
1251
- "}");
1252
- }
1253
-
1254
- TEST(SchemaValidator, Object_PatternProperties_AdditionalProperties) {
1255
- Document sd;
1256
- sd.Parse(
1257
- "{"
1258
- " \"type\": \"object\","
1259
- " \"properties\": {"
1260
- " \"builtin\": { \"type\": \"number\" }"
1261
- " },"
1262
- " \"patternProperties\": {"
1263
- " \"^S_\": { \"type\": \"string\" },"
1264
- " \"^I_\": { \"type\": \"integer\" }"
1265
- " },"
1266
- " \"additionalProperties\": { \"type\": \"string\" }"
1267
- "}");
1268
- SchemaDocument s(sd);
1269
-
1270
- VALIDATE(s, "{ \"builtin\": 42 }", true);
1271
- VALIDATE(s, "{ \"keyword\": \"value\" }", true);
1272
- INVALIDATE(s, "{ \"keyword\": 42 }", "/additionalProperties", "type", "/keyword",
1273
- "{ \"type\": {"
1274
- " \"instanceRef\": \"#/keyword\", \"schemaRef\": \"#/additionalProperties\","
1275
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1276
- "}}");
1277
- }
1278
- #endif
1279
-
1280
- TEST(SchemaValidator, Array) {
1281
- Document sd;
1282
- sd.Parse("{\"type\":\"array\"}");
1283
- SchemaDocument s(sd);
1284
-
1285
- VALIDATE(s, "[1, 2, 3, 4, 5]", true);
1286
- VALIDATE(s, "[3, \"different\", { \"types\" : \"of values\" }]", true);
1287
- INVALIDATE(s, "{\"Not\": \"an array\"}", "", "type", "",
1288
- "{ \"type\": {"
1289
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1290
- " \"expected\": [\"array\"], \"actual\": \"object\""
1291
- "}}");
1292
- }
1293
-
1294
- TEST(SchemaValidator, Array_ItemsList) {
1295
- Document sd;
1296
- sd.Parse(
1297
- "{"
1298
- " \"type\": \"array\","
1299
- " \"items\" : {"
1300
- " \"type\": \"number\""
1301
- " }"
1302
- "}");
1303
- SchemaDocument s(sd);
1304
-
1305
- VALIDATE(s, "[1, 2, 3, 4, 5]", true);
1306
- INVALIDATE(s, "[1, 2, \"3\", 4, 5]", "/items", "type", "/2",
1307
- "{ \"type\": {"
1308
- " \"instanceRef\": \"#/2\", \"schemaRef\": \"#/items\","
1309
- " \"expected\": [\"number\"], \"actual\": \"string\""
1310
- "}}");
1311
- VALIDATE(s, "[]", true);
1312
- }
1313
-
1314
- TEST(SchemaValidator, Array_ItemsTuple) {
1315
- Document sd;
1316
- sd.Parse(
1317
- "{"
1318
- " \"type\": \"array\","
1319
- " \"items\": ["
1320
- " {"
1321
- " \"type\": \"number\""
1322
- " },"
1323
- " {"
1324
- " \"type\": \"string\""
1325
- " },"
1326
- " {"
1327
- " \"type\": \"string\","
1328
- " \"enum\": [\"Street\", \"Avenue\", \"Boulevard\"]"
1329
- " },"
1330
- " {"
1331
- " \"type\": \"string\","
1332
- " \"enum\": [\"NW\", \"NE\", \"SW\", \"SE\"]"
1333
- " }"
1334
- " ]"
1335
- "}");
1336
- SchemaDocument s(sd);
1337
-
1338
- VALIDATE(s, "[1600, \"Pennsylvania\", \"Avenue\", \"NW\"]", true);
1339
- INVALIDATE(s, "[24, \"Sussex\", \"Drive\"]", "/items/2", "enum", "/2",
1340
- "{ \"enum\": { \"instanceRef\": \"#/2\", \"schemaRef\": \"#/items/2\" }}");
1341
- INVALIDATE(s, "[\"Palais de l'Elysee\"]", "/items/0", "type", "/0",
1342
- "{ \"type\": {"
1343
- " \"instanceRef\": \"#/0\", \"schemaRef\": \"#/items/0\","
1344
- " \"expected\": [\"number\"], \"actual\": \"string\""
1345
- "}}");
1346
- INVALIDATE(s, "[\"Twenty-four\", \"Sussex\", \"Drive\"]", "/items/0", "type", "/0",
1347
- "{ \"type\": {"
1348
- " \"instanceRef\": \"#/0\", \"schemaRef\": \"#/items/0\","
1349
- " \"expected\": [\"number\"], \"actual\": \"string\""
1350
- "}}"); // fail fast
1351
- VALIDATE(s, "[10, \"Downing\", \"Street\"]", true);
1352
- VALIDATE(s, "[1600, \"Pennsylvania\", \"Avenue\", \"NW\", \"Washington\"]", true);
1353
- }
1354
-
1355
- TEST(SchemaValidator, Array_AdditionalItmes) {
1356
- Document sd;
1357
- sd.Parse(
1358
- "{"
1359
- " \"type\": \"array\","
1360
- " \"items\": ["
1361
- " {"
1362
- " \"type\": \"number\""
1363
- " },"
1364
- " {"
1365
- " \"type\": \"string\""
1366
- " },"
1367
- " {"
1368
- " \"type\": \"string\","
1369
- " \"enum\": [\"Street\", \"Avenue\", \"Boulevard\"]"
1370
- " },"
1371
- " {"
1372
- " \"type\": \"string\","
1373
- " \"enum\": [\"NW\", \"NE\", \"SW\", \"SE\"]"
1374
- " }"
1375
- " ],"
1376
- " \"additionalItems\": false"
1377
- "}");
1378
- SchemaDocument s(sd);
1379
-
1380
- VALIDATE(s, "[1600, \"Pennsylvania\", \"Avenue\", \"NW\"]", true);
1381
- VALIDATE(s, "[1600, \"Pennsylvania\", \"Avenue\"]", true);
1382
- INVALIDATE(s, "[1600, \"Pennsylvania\", \"Avenue\", \"NW\", \"Washington\"]", "", "items", "/4",
1383
- "{ \"additionalItems\": {"
1384
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1385
- " \"disallowed\": 4"
1386
- "}}");
1387
- }
1388
-
1389
- TEST(SchemaValidator, Array_ItemsRange) {
1390
- Document sd;
1391
- sd.Parse("{\"type\": \"array\",\"minItems\": 2,\"maxItems\" : 3}");
1392
- SchemaDocument s(sd);
1393
-
1394
- INVALIDATE(s, "[]", "", "minItems", "",
1395
- "{ \"minItems\": {"
1396
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1397
- " \"expected\": 2, \"actual\": 0"
1398
- "}}");
1399
- INVALIDATE(s, "[1]", "", "minItems", "",
1400
- "{ \"minItems\": {"
1401
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1402
- " \"expected\": 2, \"actual\": 1"
1403
- "}}");
1404
- VALIDATE(s, "[1, 2]", true);
1405
- VALIDATE(s, "[1, 2, 3]", true);
1406
- INVALIDATE(s, "[1, 2, 3, 4]", "", "maxItems", "",
1407
- "{ \"maxItems\": {"
1408
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1409
- " \"expected\": 3, \"actual\": 4"
1410
- "}}");
1411
- }
1412
-
1413
- TEST(SchemaValidator, Array_UniqueItems) {
1414
- Document sd;
1415
- sd.Parse("{\"type\": \"array\", \"uniqueItems\": true}");
1416
- SchemaDocument s(sd);
1417
-
1418
- VALIDATE(s, "[1, 2, 3, 4, 5]", true);
1419
- INVALIDATE(s, "[1, 2, 3, 3, 4]", "", "uniqueItems", "/3",
1420
- "{ \"uniqueItems\": {"
1421
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1422
- " \"duplicates\": [2, 3]"
1423
- "}}");
1424
- INVALIDATE(s, "[1, 2, 3, 3, 3]", "", "uniqueItems", "/3",
1425
- "{ \"uniqueItems\": {"
1426
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1427
- " \"duplicates\": [2, 3]"
1428
- "}}"); // fail fast
1429
- VALIDATE(s, "[]", true);
1430
- }
1431
-
1432
- TEST(SchemaValidator, Boolean) {
1433
- Document sd;
1434
- sd.Parse("{\"type\":\"boolean\"}");
1435
- SchemaDocument s(sd);
1436
-
1437
- VALIDATE(s, "true", true);
1438
- VALIDATE(s, "false", true);
1439
- INVALIDATE(s, "\"true\"", "", "type", "",
1440
- "{ \"type\": {"
1441
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1442
- " \"expected\": [\"boolean\"], \"actual\": \"string\""
1443
- "}}");
1444
- INVALIDATE(s, "0", "", "type", "",
1445
- "{ \"type\": {"
1446
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1447
- " \"expected\": [\"boolean\"], \"actual\": \"integer\""
1448
- "}}");
1449
- }
1450
-
1451
- TEST(SchemaValidator, Null) {
1452
- Document sd;
1453
- sd.Parse("{\"type\":\"null\"}");
1454
- SchemaDocument s(sd);
1455
-
1456
- VALIDATE(s, "null", true);
1457
- INVALIDATE(s, "false", "", "type", "",
1458
- "{ \"type\": {"
1459
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1460
- " \"expected\": [\"null\"], \"actual\": \"boolean\""
1461
- "}}");
1462
- INVALIDATE(s, "0", "", "type", "",
1463
- "{ \"type\": {"
1464
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1465
- " \"expected\": [\"null\"], \"actual\": \"integer\""
1466
- "}}");
1467
- INVALIDATE(s, "\"\"", "", "type", "",
1468
- "{ \"type\": {"
1469
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1470
- " \"expected\": [\"null\"], \"actual\": \"string\""
1471
- "}}");
1472
- }
1473
-
1474
- // Additional tests
1475
-
1476
- TEST(SchemaValidator, ObjectInArray) {
1477
- Document sd;
1478
- sd.Parse("{\"type\":\"array\", \"items\": { \"type\":\"string\" }}");
1479
- SchemaDocument s(sd);
1480
-
1481
- VALIDATE(s, "[\"a\"]", true);
1482
- INVALIDATE(s, "[1]", "/items", "type", "/0",
1483
- "{ \"type\": {"
1484
- " \"instanceRef\": \"#/0\", \"schemaRef\": \"#/items\","
1485
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1486
- "}}");
1487
- INVALIDATE(s, "[{}]", "/items", "type", "/0",
1488
- "{ \"type\": {"
1489
- " \"instanceRef\": \"#/0\", \"schemaRef\": \"#/items\","
1490
- " \"expected\": [\"string\"], \"actual\": \"object\""
1491
- "}}");
1492
- }
1493
-
1494
- TEST(SchemaValidator, MultiTypeInObject) {
1495
- Document sd;
1496
- sd.Parse(
1497
- "{"
1498
- " \"type\":\"object\","
1499
- " \"properties\": {"
1500
- " \"tel\" : {"
1501
- " \"type\":[\"integer\", \"string\"]"
1502
- " }"
1503
- " }"
1504
- "}");
1505
- SchemaDocument s(sd);
1506
-
1507
- VALIDATE(s, "{ \"tel\": 999 }", true);
1508
- VALIDATE(s, "{ \"tel\": \"123-456\" }", true);
1509
- INVALIDATE(s, "{ \"tel\": true }", "/properties/tel", "type", "/tel",
1510
- "{ \"type\": {"
1511
- " \"instanceRef\": \"#/tel\", \"schemaRef\": \"#/properties/tel\","
1512
- " \"expected\": [\"string\", \"integer\"], \"actual\": \"boolean\""
1513
- "}}");
1514
- }
1515
-
1516
- TEST(SchemaValidator, MultiTypeWithObject) {
1517
- Document sd;
1518
- sd.Parse(
1519
- "{"
1520
- " \"type\": [\"object\",\"string\"],"
1521
- " \"properties\": {"
1522
- " \"tel\" : {"
1523
- " \"type\": \"integer\""
1524
- " }"
1525
- " }"
1526
- "}");
1527
- SchemaDocument s(sd);
1528
-
1529
- VALIDATE(s, "\"Hello\"", true);
1530
- VALIDATE(s, "{ \"tel\": 999 }", true);
1531
- INVALIDATE(s, "{ \"tel\": \"fail\" }", "/properties/tel", "type", "/tel",
1532
- "{ \"type\": {"
1533
- " \"instanceRef\": \"#/tel\", \"schemaRef\": \"#/properties/tel\","
1534
- " \"expected\": [\"integer\"], \"actual\": \"string\""
1535
- "}}");
1536
- }
1537
-
1538
- TEST(SchemaValidator, AllOf_Nested) {
1539
- Document sd;
1540
- sd.Parse(
1541
- "{"
1542
- " \"allOf\": ["
1543
- " { \"type\": \"string\", \"minLength\": 2 },"
1544
- " { \"type\": \"string\", \"maxLength\": 5 },"
1545
- " { \"allOf\": [ { \"enum\" : [\"ok\", \"okay\", \"OK\", \"o\"] }, { \"enum\" : [\"ok\", \"OK\", \"o\"]} ] }"
1546
- " ]"
1547
- "}");
1548
- SchemaDocument s(sd);
1549
-
1550
- VALIDATE(s, "\"ok\"", true);
1551
- VALIDATE(s, "\"OK\"", true);
1552
- INVALIDATE(s, "\"okay\"", "", "allOf", "",
1553
- "{ \"enum\": {"
1554
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/1\""
1555
- "}}");
1556
- INVALIDATE(s, "\"o\"", "", "allOf", "",
1557
- "{ \"minLength\": {"
1558
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/0\","
1559
- " \"expected\": 2, \"actual\": \"o\""
1560
- "}}");
1561
- INVALIDATE(s, "\"n\"", "", "allOf", "",
1562
- "{ \"minLength\": {"
1563
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/0\","
1564
- " \"expected\": 2, \"actual\": \"n\""
1565
- " },"
1566
- " \"enum\": ["
1567
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/0\"},"
1568
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/1\"}"
1569
- " ]"
1570
- "}")
1571
- INVALIDATE(s, "\"too long\"", "", "allOf", "",
1572
- "{ \"maxLength\": {"
1573
- " \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/1\","
1574
- " \"expected\": 5, \"actual\": \"too long\""
1575
- " },"
1576
- " \"enum\": ["
1577
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/0\"},"
1578
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/1\"}"
1579
- " ]"
1580
- "}");
1581
- INVALIDATE(s, "123", "", "allOf", "",
1582
- "{ \"type\": ["
1583
- " { \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/0\","
1584
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1585
- " },"
1586
- " { \"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/1\","
1587
- " \"expected\": [\"string\"], \"actual\": \"integer\""
1588
- " }"
1589
- " ],"
1590
- " \"enum\": ["
1591
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/0\"},"
1592
- " {\"instanceRef\": \"#\", \"schemaRef\": \"#/allOf/2/allOf/1\"}"
1593
- " ]"
1594
- "}");
1595
- }
1596
-
1597
- TEST(SchemaValidator, EscapedPointer) {
1598
- Document sd;
1599
- sd.Parse(
1600
- "{"
1601
- " \"type\": \"object\","
1602
- " \"properties\": {"
1603
- " \"~/\": { \"type\": \"number\" }"
1604
- " }"
1605
- "}");
1606
- SchemaDocument s(sd);
1607
- INVALIDATE(s, "{\"~/\":true}", "/properties/~0~1", "type", "/~0~1",
1608
- "{ \"type\": {"
1609
- " \"instanceRef\": \"#/~0~1\", \"schemaRef\": \"#/properties/~0~1\","
1610
- " \"expected\": [\"number\"], \"actual\": \"boolean\""
1611
- "}}");
1612
- }
1613
-
1614
- template <typename Allocator>
1615
- static char* ReadFile(const char* filename, Allocator& allocator) {
1616
- const char *paths[] = {
1617
- "",
1618
- "bin/",
1619
- "../bin/",
1620
- "../../bin/",
1621
- "../../../bin/"
1622
- };
1623
- char buffer[1024];
1624
- FILE *fp = 0;
1625
- for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
1626
- sprintf(buffer, "%s%s", paths[i], filename);
1627
- fp = fopen(buffer, "rb");
1628
- if (fp)
1629
- break;
1630
- }
1631
-
1632
- if (!fp)
1633
- return 0;
1634
-
1635
- fseek(fp, 0, SEEK_END);
1636
- size_t length = static_cast<size_t>(ftell(fp));
1637
- fseek(fp, 0, SEEK_SET);
1638
- char* json = reinterpret_cast<char*>(allocator.Malloc(length + 1));
1639
- size_t readLength = fread(json, 1, length, fp);
1640
- json[readLength] = '\0';
1641
- fclose(fp);
1642
- return json;
1643
- }
1644
-
1645
- TEST(SchemaValidator, ValidateMetaSchema) {
1646
- CrtAllocator allocator;
1647
- char* json = ReadFile("draft-04/schema", allocator);
1648
- Document d;
1649
- d.Parse(json);
1650
- ASSERT_FALSE(d.HasParseError());
1651
- SchemaDocument sd(d);
1652
- SchemaValidator validator(sd);
1653
- if (!d.Accept(validator)) {
1654
- StringBuffer sb;
1655
- validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
1656
- printf("Invalid schema: %s\n", sb.GetString());
1657
- printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());
1658
- sb.Clear();
1659
- validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
1660
- printf("Invalid document: %s\n", sb.GetString());
1661
- sb.Clear();
1662
- Writer<StringBuffer> w(sb);
1663
- validator.GetError().Accept(w);
1664
- printf("Validation error: %s\n", sb.GetString());
1665
- ADD_FAILURE();
1666
- }
1667
- CrtAllocator::Free(json);
1668
- }
1669
-
1670
- TEST(SchemaValidator, ValidateMetaSchema_UTF16) {
1671
- typedef GenericDocument<UTF16<> > D;
1672
- typedef GenericSchemaDocument<D::ValueType> SD;
1673
- typedef GenericSchemaValidator<SD> SV;
1674
-
1675
- CrtAllocator allocator;
1676
- char* json = ReadFile("draft-04/schema", allocator);
1677
-
1678
- D d;
1679
- StringStream ss(json);
1680
- d.ParseStream<0, UTF8<> >(ss);
1681
- ASSERT_FALSE(d.HasParseError());
1682
- SD sd(d);
1683
- SV validator(sd);
1684
- if (!d.Accept(validator)) {
1685
- GenericStringBuffer<UTF16<> > sb;
1686
- validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);
1687
- wprintf(L"Invalid schema: %ls\n", sb.GetString());
1688
- wprintf(L"Invalid keyword: %ls\n", validator.GetInvalidSchemaKeyword());
1689
- sb.Clear();
1690
- validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);
1691
- wprintf(L"Invalid document: %ls\n", sb.GetString());
1692
- sb.Clear();
1693
- Writer<GenericStringBuffer<UTF16<> >, UTF16<> > w(sb);
1694
- validator.GetError().Accept(w);
1695
- printf("Validation error: %ls\n", sb.GetString());
1696
- ADD_FAILURE();
1697
- }
1698
- CrtAllocator::Free(json);
1699
- }
1700
-
1701
- template <typename SchemaDocumentType = SchemaDocument>
1702
- class RemoteSchemaDocumentProvider : public IGenericRemoteSchemaDocumentProvider<SchemaDocumentType> {
1703
- public:
1704
- RemoteSchemaDocumentProvider() :
1705
- documentAllocator_(documentBuffer_, sizeof(documentBuffer_)),
1706
- schemaAllocator_(schemaBuffer_, sizeof(schemaBuffer_))
1707
- {
1708
- const char* filenames[kCount] = {
1709
- "jsonschema/remotes/integer.json",
1710
- "jsonschema/remotes/subSchemas.json",
1711
- "jsonschema/remotes/folder/folderInteger.json",
1712
- "draft-04/schema"
1713
- };
1714
- const char* uris[kCount] = {
1715
- "http://localhost:1234/integer.json",
1716
- "http://localhost:1234/subSchemas.json",
1717
- "http://localhost:1234/folder/folderInteger.json",
1718
- "http://json-schema.org/draft-04/schema"
1719
- };
1720
-
1721
- for (size_t i = 0; i < kCount; i++) {
1722
- sd_[i] = 0;
1723
-
1724
- char jsonBuffer[8192];
1725
- MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
1726
- char* json = ReadFile(filenames[i], jsonAllocator);
1727
- if (!json) {
1728
- printf("json remote file %s not found", filenames[i]);
1729
- ADD_FAILURE();
1730
- }
1731
- else {
1732
- char stackBuffer[4096];
1733
- MemoryPoolAllocator<> stackAllocator(stackBuffer, sizeof(stackBuffer));
1734
- DocumentType d(&documentAllocator_, 1024, &stackAllocator);
1735
- d.Parse(json);
1736
- sd_[i] = new SchemaDocumentType(d, uris[i], static_cast<SizeType>(strlen(uris[i])), 0, &schemaAllocator_);
1737
- MemoryPoolAllocator<>::Free(json);
1738
- }
1739
- };
1740
- }
1741
-
1742
- ~RemoteSchemaDocumentProvider() {
1743
- for (size_t i = 0; i < kCount; i++)
1744
- delete sd_[i];
1745
- }
1746
-
1747
- virtual const SchemaDocumentType* GetRemoteDocument(const char* uri, SizeType length) {
1748
- for (size_t i = 0; i < kCount; i++)
1749
- if (typename SchemaDocumentType::URIType(uri, length) == sd_[i]->GetURI())
1750
- return sd_[i];
1751
- return 0;
1752
- }
1753
-
1754
- private:
1755
- typedef GenericDocument<typename SchemaDocumentType::EncodingType, MemoryPoolAllocator<>, MemoryPoolAllocator<> > DocumentType;
1756
-
1757
- RemoteSchemaDocumentProvider(const RemoteSchemaDocumentProvider&);
1758
- RemoteSchemaDocumentProvider& operator=(const RemoteSchemaDocumentProvider&);
1759
-
1760
- static const size_t kCount = 4;
1761
- SchemaDocumentType* sd_[kCount];
1762
- typename DocumentType::AllocatorType documentAllocator_;
1763
- typename SchemaDocumentType::AllocatorType schemaAllocator_;
1764
- char documentBuffer_[16384];
1765
- char schemaBuffer_[128u * 1024];
1766
- };
1767
-
1768
- TEST(SchemaValidator, TestSuite) {
1769
- const char* filenames[] = {
1770
- "additionalItems.json",
1771
- "additionalProperties.json",
1772
- "allOf.json",
1773
- "anyOf.json",
1774
- "default.json",
1775
- "definitions.json",
1776
- "dependencies.json",
1777
- "enum.json",
1778
- "items.json",
1779
- "maximum.json",
1780
- "maxItems.json",
1781
- "maxLength.json",
1782
- "maxProperties.json",
1783
- "minimum.json",
1784
- "minItems.json",
1785
- "minLength.json",
1786
- "minProperties.json",
1787
- "multipleOf.json",
1788
- "not.json",
1789
- "oneOf.json",
1790
- "pattern.json",
1791
- "patternProperties.json",
1792
- "properties.json",
1793
- "ref.json",
1794
- "refRemote.json",
1795
- "required.json",
1796
- "type.json",
1797
- "uniqueItems.json"
1798
- };
1799
-
1800
- const char* onlyRunDescription = 0;
1801
- //const char* onlyRunDescription = "a string is a string";
1802
-
1803
- unsigned testCount = 0;
1804
- unsigned passCount = 0;
1805
-
1806
- typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
1807
- RemoteSchemaDocumentProvider<SchemaDocumentType> provider;
1808
-
1809
- char jsonBuffer[65536];
1810
- char documentBuffer[65536];
1811
- char documentStackBuffer[65536];
1812
- char schemaBuffer[65536];
1813
- char validatorBuffer[65536];
1814
- MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
1815
- MemoryPoolAllocator<> documentAllocator(documentBuffer, sizeof(documentBuffer));
1816
- MemoryPoolAllocator<> documentStackAllocator(documentStackBuffer, sizeof(documentStackBuffer));
1817
- MemoryPoolAllocator<> schemaAllocator(schemaBuffer, sizeof(schemaBuffer));
1818
- MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
1819
-
1820
- for (size_t i = 0; i < sizeof(filenames) / sizeof(filenames[0]); i++) {
1821
- char filename[FILENAME_MAX];
1822
- sprintf(filename, "jsonschema/tests/draft4/%s", filenames[i]);
1823
- char* json = ReadFile(filename, jsonAllocator);
1824
- if (!json) {
1825
- printf("json test suite file %s not found", filename);
1826
- ADD_FAILURE();
1827
- }
1828
- else {
1829
- GenericDocument<UTF8<>, MemoryPoolAllocator<>, MemoryPoolAllocator<> > d(&documentAllocator, 1024, &documentStackAllocator);
1830
- d.Parse(json);
1831
- if (d.HasParseError()) {
1832
- printf("json test suite file %s has parse error", filename);
1833
- ADD_FAILURE();
1834
- }
1835
- else {
1836
- for (Value::ConstValueIterator schemaItr = d.Begin(); schemaItr != d.End(); ++schemaItr) {
1837
- {
1838
- SchemaDocumentType schema((*schemaItr)["schema"], filenames[i], static_cast<SizeType>(strlen(filenames[i])), &provider, &schemaAllocator);
1839
- GenericSchemaValidator<SchemaDocumentType, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator(schema, &validatorAllocator);
1840
- const char* description1 = (*schemaItr)["description"].GetString();
1841
- const Value& tests = (*schemaItr)["tests"];
1842
- for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) {
1843
- const char* description2 = (*testItr)["description"].GetString();
1844
- if (!onlyRunDescription || strcmp(description2, onlyRunDescription) == 0) {
1845
- const Value& data = (*testItr)["data"];
1846
- bool expected = (*testItr)["valid"].GetBool();
1847
- testCount++;
1848
- validator.Reset();
1849
- bool actual = data.Accept(validator);
1850
- if (expected != actual)
1851
- printf("Fail: %30s \"%s\" \"%s\"\n", filename, description1, description2);
1852
- else
1853
- passCount++;
1854
- }
1855
- }
1856
- //printf("%zu %zu %zu\n", documentAllocator.Size(), schemaAllocator.Size(), validatorAllocator.Size());
1857
- }
1858
- schemaAllocator.Clear();
1859
- validatorAllocator.Clear();
1860
- }
1861
- }
1862
- }
1863
- documentAllocator.Clear();
1864
- MemoryPoolAllocator<>::Free(json);
1865
- jsonAllocator.Clear();
1866
- }
1867
- printf("%d / %d passed (%2d%%)\n", passCount, testCount, passCount * 100 / testCount);
1868
- // if (passCount != testCount)
1869
- // ADD_FAILURE();
1870
- }
1871
-
1872
- TEST(SchemaValidatingReader, Simple) {
1873
- Document sd;
1874
- sd.Parse("{ \"type\": \"string\", \"enum\" : [\"red\", \"amber\", \"green\"] }");
1875
- SchemaDocument s(sd);
1876
-
1877
- Document d;
1878
- StringStream ss("\"red\"");
1879
- SchemaValidatingReader<kParseDefaultFlags, StringStream, UTF8<> > reader(ss, s);
1880
- d.Populate(reader);
1881
- EXPECT_TRUE(reader.GetParseResult());
1882
- EXPECT_TRUE(reader.IsValid());
1883
- EXPECT_TRUE(d.IsString());
1884
- EXPECT_STREQ("red", d.GetString());
1885
- }
1886
-
1887
- TEST(SchemaValidatingReader, Invalid) {
1888
- Document sd;
1889
- sd.Parse("{\"type\":\"string\",\"minLength\":2,\"maxLength\":3}");
1890
- SchemaDocument s(sd);
1891
-
1892
- Document d;
1893
- StringStream ss("\"ABCD\"");
1894
- SchemaValidatingReader<kParseDefaultFlags, StringStream, UTF8<> > reader(ss, s);
1895
- d.Populate(reader);
1896
- EXPECT_FALSE(reader.GetParseResult());
1897
- EXPECT_FALSE(reader.IsValid());
1898
- EXPECT_EQ(kParseErrorTermination, reader.GetParseResult().Code());
1899
- EXPECT_STREQ("maxLength", reader.GetInvalidSchemaKeyword());
1900
- EXPECT_TRUE(reader.GetInvalidSchemaPointer() == SchemaDocument::PointerType(""));
1901
- EXPECT_TRUE(reader.GetInvalidDocumentPointer() == SchemaDocument::PointerType(""));
1902
- EXPECT_TRUE(d.IsNull());
1903
- Document e;
1904
- e.Parse(
1905
- "{ \"maxLength\": {"
1906
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1907
- " \"expected\": 3, \"actual\": \"ABCD\""
1908
- "}}");
1909
- if (e != reader.GetError()) {
1910
- ADD_FAILURE();
1911
- }
1912
- }
1913
-
1914
- TEST(SchemaValidatingWriter, Simple) {
1915
- Document sd;
1916
- sd.Parse("{\"type\":\"string\",\"minLength\":2,\"maxLength\":3}");
1917
- SchemaDocument s(sd);
1918
-
1919
- Document d;
1920
- StringBuffer sb;
1921
- Writer<StringBuffer> writer(sb);
1922
- GenericSchemaValidator<SchemaDocument, Writer<StringBuffer> > validator(s, writer);
1923
-
1924
- d.Parse("\"red\"");
1925
- EXPECT_TRUE(d.Accept(validator));
1926
- EXPECT_TRUE(validator.IsValid());
1927
- EXPECT_STREQ("\"red\"", sb.GetString());
1928
-
1929
- sb.Clear();
1930
- validator.Reset();
1931
- d.Parse("\"ABCD\"");
1932
- EXPECT_FALSE(d.Accept(validator));
1933
- EXPECT_FALSE(validator.IsValid());
1934
- EXPECT_TRUE(validator.GetInvalidSchemaPointer() == SchemaDocument::PointerType(""));
1935
- EXPECT_TRUE(validator.GetInvalidDocumentPointer() == SchemaDocument::PointerType(""));
1936
- Document e;
1937
- e.Parse(
1938
- "{ \"maxLength\": {"
1939
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1940
- " \"expected\": 3, \"actual\": \"ABCD\""
1941
- "}}");
1942
- EXPECT_EQ(e, validator.GetError());
1943
- }
1944
-
1945
- TEST(Schema, Issue848) {
1946
- rapidjson::Document d;
1947
- rapidjson::SchemaDocument s(d);
1948
- rapidjson::GenericSchemaValidator<rapidjson::SchemaDocument, rapidjson::Document> v(s);
1949
- }
1950
-
1951
- #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
1952
-
1953
- static SchemaDocument ReturnSchemaDocument() {
1954
- Document sd;
1955
- sd.Parse("{ \"type\": [\"number\", \"string\"] }");
1956
- SchemaDocument s(sd);
1957
- return s;
1958
- }
1959
-
1960
- TEST(Schema, Issue552) {
1961
- SchemaDocument s = ReturnSchemaDocument();
1962
- VALIDATE(s, "42", true);
1963
- VALIDATE(s, "\"Life, the universe, and everything\"", true);
1964
- INVALIDATE(s, "[\"Life\", \"the universe\", \"and everything\"]", "", "type", "",
1965
- "{ \"type\": {"
1966
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1967
- " \"expected\": [\"string\", \"number\"], \"actual\": \"array\""
1968
- "}}");
1969
- }
1970
-
1971
- #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
1972
-
1973
- TEST(SchemaValidator, Issue608) {
1974
- Document sd;
1975
- sd.Parse("{\"required\": [\"a\", \"b\"] }");
1976
- SchemaDocument s(sd);
1977
-
1978
- VALIDATE(s, "{\"a\" : null, \"b\": null}", true);
1979
- INVALIDATE(s, "{\"a\" : null, \"a\" : null}", "", "required", "",
1980
- "{ \"required\": {"
1981
- " \"instanceRef\": \"#\", \"schemaRef\": \"#\","
1982
- " \"missing\": [\"b\"]"
1983
- "}}");
1984
- }
1985
-
1986
- // Fail to resolve $ref in allOf causes crash in SchemaValidator::StartObject()
1987
- TEST(SchemaValidator, Issue728_AllOfRef) {
1988
- Document sd;
1989
- sd.Parse("{\"allOf\": [{\"$ref\": \"#/abc\"}]}");
1990
- SchemaDocument s(sd);
1991
- VALIDATE(s, "{\"key1\": \"abc\", \"key2\": \"def\"}", true);
1992
- }
1993
-
1994
- TEST(SchemaValidator, Issue825) {
1995
- Document sd;
1996
- sd.Parse("{\"type\": \"object\", \"additionalProperties\": false, \"patternProperties\": {\"^i\": { \"type\": \"string\" } } }");
1997
- SchemaDocument s(sd);
1998
- VALIDATE(s, "{ \"item\": \"hello\" }", true);
1999
- }
2000
-
2001
- TEST(SchemaValidator, Issue1017_allOfHandler) {
2002
- Document sd;
2003
- sd.Parse("{\"allOf\": [{\"type\": \"object\",\"properties\": {\"cyanArray2\": {\"type\": \"array\",\"items\": { \"type\": \"string\" }}}},{\"type\": \"object\",\"properties\": {\"blackArray\": {\"type\": \"array\",\"items\": { \"type\": \"string\" }}},\"required\": [ \"blackArray\" ]}]}");
2004
- SchemaDocument s(sd);
2005
- StringBuffer sb;
2006
- Writer<StringBuffer> writer(sb);
2007
- GenericSchemaValidator<SchemaDocument, Writer<StringBuffer> > validator(s, writer);
2008
- EXPECT_TRUE(validator.StartObject());
2009
- EXPECT_TRUE(validator.Key("cyanArray2", 10, false));
2010
- EXPECT_TRUE(validator.StartArray());
2011
- EXPECT_TRUE(validator.EndArray(0));
2012
- EXPECT_TRUE(validator.Key("blackArray", 10, false));
2013
- EXPECT_TRUE(validator.StartArray());
2014
- EXPECT_TRUE(validator.EndArray(0));
2015
- EXPECT_TRUE(validator.EndObject(0));
2016
- EXPECT_TRUE(validator.IsValid());
2017
- EXPECT_STREQ("{\"cyanArray2\":[],\"blackArray\":[]}", sb.GetString());
2018
- }
2019
-
2020
- TEST(SchemaValidator, Ref_remote) {
2021
- typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
2022
- RemoteSchemaDocumentProvider<SchemaDocumentType> provider;
2023
- Document sd;
2024
- sd.Parse("{\"$ref\": \"http://localhost:1234/subSchemas.json#/integer\"}");
2025
- SchemaDocumentType s(sd, 0, 0, &provider);
2026
- typedef GenericSchemaValidator<SchemaDocumentType, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > SchemaValidatorType;
2027
- typedef GenericPointer<Value, MemoryPoolAllocator<> > PointerType;
2028
- INVALIDATE_(s, "null", "/integer", "type", "",
2029
- "{ \"type\": {"
2030
- " \"instanceRef\": \"#\","
2031
- " \"schemaRef\": \"http://localhost:1234/subSchemas.json#/integer\","
2032
- " \"expected\": [\"integer\"], \"actual\": \"null\""
2033
- "}}",
2034
- SchemaValidatorType, PointerType);
2035
- }
2036
-
2037
- TEST(SchemaValidator, Ref_remote_issue1210) {
2038
- class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider {
2039
- SchemaDocument** collection;
2040
-
2041
- SchemaDocumentProvider(const SchemaDocumentProvider&);
2042
- SchemaDocumentProvider& operator=(const SchemaDocumentProvider&);
2043
-
2044
- public:
2045
- SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { }
2046
- virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) {
2047
- int i = 0;
2048
- while (collection[i] && SchemaDocument::URIType(uri, length) != collection[i]->GetURI()) ++i;
2049
- return collection[i];
2050
- }
2051
- };
2052
- SchemaDocument* collection[] = { 0, 0, 0 };
2053
- SchemaDocumentProvider provider(collection);
2054
-
2055
- Document x, y, z;
2056
- x.Parse("{\"properties\":{\"country\":{\"$ref\":\"y.json#/definitions/country_remote\"}},\"type\":\"object\"}");
2057
- y.Parse("{\"definitions\":{\"country_remote\":{\"$ref\":\"z.json#/definitions/country_list\"}}}");
2058
- z.Parse("{\"definitions\":{\"country_list\":{\"enum\":[\"US\"]}}}");
2059
-
2060
- SchemaDocument sz(z, "z.json", 6, &provider);
2061
- collection[0] = &sz;
2062
- SchemaDocument sy(y, "y.json", 6, &provider);
2063
- collection[1] = &sy;
2064
- SchemaDocument sx(x, "x.json", 6, &provider);
2065
-
2066
- VALIDATE(sx, "{\"country\":\"UK\"}", false);
2067
- VALIDATE(sx, "{\"country\":\"US\"}", true);
2068
- }
2069
-
2070
- #if defined(_MSC_VER) || defined(__clang__)
2071
- RAPIDJSON_DIAG_POP
2072
- #endif