trusty-cms 5.0.4 → 5.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +68 -68
  3. data/app/models/asset.rb +8 -2
  4. data/app/views/admin/assets/_asset_table.html.haml +1 -1
  5. data/app/views/admin/assets/_search.html.haml +1 -1
  6. data/app/views/admin/assets/_search_results.html.haml +2 -2
  7. data/app/views/admin/assets/edit.html.haml +5 -5
  8. data/app/views/admin/assets/index.html.haml +1 -1
  9. data/app/views/admin/configuration/_clipped_show.html.haml +1 -1
  10. data/app/views/admin/pages/_asset_popups.html.haml +5 -5
  11. data/app/views/admin/removed/_assets_bucket.html.haml +2 -2
  12. data/app/views/admin/removed/_assets_container.html.haml +6 -6
  13. data/app/views/admin/removed/_bucket.html.haml +1 -1
  14. data/app/views/admin/removed/_upload_to_page.html.haml +1 -1
  15. data/app/views/admin/sites/_form.haml +2 -2
  16. data/app/views/admin/snippets/edit.html.haml +1 -1
  17. data/app/views/admin/snippets/new.html.haml +1 -1
  18. data/lib/generators/extension_controller/templates/view_spec.rb +1 -1
  19. data/lib/generators/generator_base_extension.rb +0 -1
  20. data/lib/generators/instance/instance_generator.rb +1 -1
  21. data/lib/generators/language_extension/language_extension_generator.rb +0 -1
  22. data/lib/generators/language_extension/templates/test_helper.rb +0 -1
  23. data/lib/generators/trusty_cms/trusty_cms_generator.rb +0 -2
  24. data/lib/trusty_cms.rb +1 -1
  25. data/node_modules/ajv/README.md +158 -72
  26. data/node_modules/ajv/dist/ajv.bundle.js +136 -112
  27. data/node_modules/ajv/dist/ajv.min.js +2 -2
  28. data/node_modules/ajv/dist/ajv.min.js.map +1 -1
  29. data/node_modules/ajv/lib/ajv.d.ts +3 -1
  30. data/node_modules/ajv/lib/compile/equal.js +1 -1
  31. data/node_modules/ajv/lib/compile/formats.js +4 -4
  32. data/node_modules/ajv/lib/compile/index.js +1 -1
  33. data/node_modules/ajv/lib/compile/util.js +9 -44
  34. data/node_modules/ajv/lib/data.js +1 -1
  35. data/node_modules/ajv/lib/definition_schema.js +1 -1
  36. data/node_modules/ajv/lib/dot/_limit.jst +9 -0
  37. data/node_modules/ajv/lib/dot/_limitItems.jst +2 -0
  38. data/node_modules/ajv/lib/dot/_limitLength.jst +2 -0
  39. data/node_modules/ajv/lib/dot/_limitProperties.jst +2 -0
  40. data/node_modules/ajv/lib/dot/allOf.jst +0 -2
  41. data/node_modules/ajv/lib/dot/anyOf.jst +0 -2
  42. data/node_modules/ajv/lib/dot/coerce.def +18 -28
  43. data/node_modules/ajv/lib/dot/contains.jst +0 -2
  44. data/node_modules/ajv/lib/dot/definitions.def +9 -7
  45. data/node_modules/ajv/lib/dot/dependencies.jst +1 -2
  46. data/node_modules/ajv/lib/dot/if.jst +0 -2
  47. data/node_modules/ajv/lib/dot/items.jst +0 -2
  48. data/node_modules/ajv/lib/dot/multipleOf.jst +2 -0
  49. data/node_modules/ajv/lib/dot/properties.jst +6 -5
  50. data/node_modules/ajv/lib/dot/propertyNames.jst +0 -2
  51. data/node_modules/ajv/lib/dot/uniqueItems.jst +1 -1
  52. data/node_modules/ajv/lib/dot/validate.jst +3 -9
  53. data/node_modules/ajv/lib/dotjs/_limit.js +6 -0
  54. data/node_modules/ajv/lib/dotjs/_limitItems.js +3 -0
  55. data/node_modules/ajv/lib/dotjs/_limitLength.js +3 -0
  56. data/node_modules/ajv/lib/dotjs/_limitProperties.js +3 -0
  57. data/node_modules/ajv/lib/dotjs/allOf.js +1 -2
  58. data/node_modules/ajv/lib/dotjs/anyOf.js +1 -2
  59. data/node_modules/ajv/lib/dotjs/contains.js +1 -2
  60. data/node_modules/ajv/lib/dotjs/dependencies.js +2 -2
  61. data/node_modules/ajv/lib/dotjs/if.js +2 -3
  62. data/node_modules/ajv/lib/dotjs/items.js +3 -4
  63. data/node_modules/ajv/lib/dotjs/multipleOf.js +3 -0
  64. data/node_modules/ajv/lib/dotjs/not.js +1 -1
  65. data/node_modules/ajv/lib/dotjs/oneOf.js +1 -1
  66. data/node_modules/ajv/lib/dotjs/properties.js +11 -6
  67. data/node_modules/ajv/lib/dotjs/propertyNames.js +1 -2
  68. data/node_modules/ajv/lib/dotjs/required.js +1 -1
  69. data/node_modules/ajv/lib/dotjs/uniqueItems.js +1 -1
  70. data/node_modules/ajv/lib/dotjs/validate.js +13 -25
  71. data/node_modules/ajv/lib/keyword.js +1 -1
  72. data/node_modules/ajv/lib/refs/data.json +1 -1
  73. data/node_modules/ajv/lib/refs/json-schema-secure.json +1 -1
  74. data/node_modules/ajv/package.json +18 -10
  75. data/node_modules/ajv/scripts/info +0 -0
  76. data/node_modules/ajv/scripts/prepare-tests +0 -0
  77. data/node_modules/ajv/scripts/publish-built-version +1 -1
  78. data/node_modules/ajv/scripts/travis-gh-pages +1 -1
  79. data/node_modules/fast-deep-equal/es6/index.d.ts +1 -1
  80. data/node_modules/fast-deep-equal/es6/react.d.ts +1 -1
  81. data/node_modules/fast-deep-equal/package.json +7 -7
  82. data/node_modules/fast-deep-equal/react.d.ts +1 -1
  83. data/node_modules/uri-js/LICENSE +11 -0
  84. data/node_modules/uri-js/README.md +22 -18
  85. data/node_modules/uri-js/dist/es5/uri.all.d.ts +59 -59
  86. data/node_modules/uri-js/dist/es5/uri.all.js +61 -7
  87. data/node_modules/uri-js/dist/es5/uri.all.js.map +1 -1
  88. data/node_modules/uri-js/dist/es5/uri.all.min.d.ts +59 -59
  89. data/node_modules/uri-js/dist/es5/uri.all.min.js +2 -2
  90. data/node_modules/uri-js/dist/es5/uri.all.min.js.map +1 -1
  91. data/node_modules/uri-js/dist/esnext/index.d.ts +1 -1
  92. data/node_modules/uri-js/dist/esnext/index.js +16 -12
  93. data/node_modules/uri-js/dist/esnext/index.js.map +1 -1
  94. data/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +3 -3
  95. data/node_modules/uri-js/dist/esnext/regexps-iri.js +2 -2
  96. data/node_modules/uri-js/dist/esnext/regexps-iri.js.map +0 -0
  97. data/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +4 -4
  98. data/node_modules/uri-js/dist/esnext/regexps-uri.js +41 -41
  99. data/node_modules/uri-js/dist/esnext/regexps-uri.js.map +0 -0
  100. data/node_modules/uri-js/dist/esnext/schemes/http.d.ts +3 -3
  101. data/node_modules/uri-js/dist/esnext/schemes/http.js +27 -26
  102. data/node_modules/uri-js/dist/esnext/schemes/http.js.map +1 -1
  103. data/node_modules/uri-js/dist/esnext/schemes/https.d.ts +3 -3
  104. data/node_modules/uri-js/dist/esnext/schemes/https.js +8 -8
  105. data/node_modules/uri-js/dist/esnext/schemes/https.js.map +0 -0
  106. data/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +12 -12
  107. data/node_modules/uri-js/dist/esnext/schemes/mailto.js +0 -0
  108. data/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +0 -0
  109. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +7 -7
  110. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +22 -22
  111. data/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +0 -0
  112. data/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +10 -10
  113. data/node_modules/uri-js/dist/esnext/schemes/urn.js +48 -48
  114. data/node_modules/uri-js/dist/esnext/schemes/urn.js.map +0 -0
  115. data/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +7 -0
  116. data/node_modules/uri-js/dist/esnext/schemes/ws.js +41 -0
  117. data/node_modules/uri-js/dist/esnext/schemes/ws.js.map +1 -0
  118. data/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +3 -0
  119. data/node_modules/uri-js/dist/esnext/schemes/wss.js +9 -0
  120. data/node_modules/uri-js/dist/esnext/schemes/wss.js.map +1 -0
  121. data/node_modules/uri-js/dist/esnext/uri.d.ts +59 -59
  122. data/node_modules/uri-js/dist/esnext/uri.js +2 -2
  123. data/node_modules/uri-js/dist/esnext/uri.js.map +1 -1
  124. data/node_modules/uri-js/dist/esnext/util.d.ts +6 -6
  125. data/node_modules/uri-js/dist/esnext/util.js +35 -35
  126. data/node_modules/uri-js/dist/esnext/util.js.map +0 -0
  127. data/node_modules/uri-js/package.json +19 -7
  128. data/node_modules/uri-js/yarn.lock +1271 -615
  129. data/trusty_cms.gemspec +2 -1
  130. data/yarn.lock +9 -9
  131. metadata +9 -21
  132. data/node_modules/uri-js/bower.json +0 -47
  133. data/node_modules/uri-js/rollup.config.js +0 -32
  134. data/node_modules/uri-js/src/index.ts +0 -18
  135. data/node_modules/uri-js/src/punycode.d.ts +0 -24
  136. data/node_modules/uri-js/src/regexps-iri.ts +0 -4
  137. data/node_modules/uri-js/src/regexps-uri.ts +0 -89
  138. data/node_modules/uri-js/src/schemes/http.ts +0 -36
  139. data/node_modules/uri-js/src/schemes/https.ts +0 -11
  140. data/node_modules/uri-js/src/schemes/mailto.ts +0 -182
  141. data/node_modules/uri-js/src/schemes/urn-uuid.ts +0 -36
  142. data/node_modules/uri-js/src/schemes/urn.ts +0 -69
  143. data/node_modules/uri-js/src/uri.ts +0 -556
  144. data/node_modules/uri-js/src/util.ts +0 -40
  145. data/node_modules/uri-js/tests/qunit.css +0 -118
  146. data/node_modules/uri-js/tests/qunit.js +0 -1042
  147. data/node_modules/uri-js/tests/test-es5-min.html +0 -17
  148. data/node_modules/uri-js/tests/test-es5.html +0 -17
  149. data/node_modules/uri-js/tests/tests.js +0 -774
  150. data/node_modules/uri-js/tsconfig.json +0 -20
@@ -137,6 +137,7 @@ declare namespace ajv {
137
137
  */
138
138
  errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
139
139
  errors?: Array<ErrorObject> | null;
140
+ _opts: Options;
140
141
  }
141
142
 
142
143
  interface CustomLogger {
@@ -183,6 +184,7 @@ declare namespace ajv {
183
184
  coerceTypes?: boolean | 'array';
184
185
  strictDefaults?: boolean | 'log';
185
186
  strictKeywords?: boolean | 'log';
187
+ strictNumbers?: boolean;
186
188
  async?: boolean | string;
187
189
  transpile?: string | ((code: string) => string);
188
190
  meta?: boolean | object;
@@ -196,7 +198,7 @@ declare namespace ajv {
196
198
  errorDataPath?: string,
197
199
  messages?: boolean;
198
200
  sourceCode?: boolean;
199
- processCode?: (code: string) => string;
201
+ processCode?: (code: string, schema: object) => string;
200
202
  cache?: object;
201
203
  logger?: CustomLogger | false;
202
204
  nullable?: boolean;
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
3
  // do NOT remove this file - it would break pre-compiled schemas
4
- // https://github.com/epoberezkin/ajv/issues/889
4
+ // https://github.com/ajv-validator/ajv/issues/889
5
5
  module.exports = require('fast-deep-equal');
@@ -13,8 +13,8 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|
13
13
  // For the source: https://gist.github.com/dperini/729294
14
14
  // For test cases: https://mathiasbynens.be/demo/url-regex
15
15
  // @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
16
- // var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
17
- var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
16
+ // var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
17
+ var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
18
18
  var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
19
19
  var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20
20
  var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
@@ -36,8 +36,8 @@ formats.fast = {
36
36
  time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
37
37
  'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
38
38
  // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
39
- uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
40
- 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
39
+ uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
40
+ 'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
41
41
  'uri-template': URITEMPLATE,
42
42
  url: URL,
43
43
  // email (sources from jsen validator):
@@ -113,7 +113,7 @@ function compile(schema, root, localRefs, baseId) {
113
113
  + vars(defaults, defaultCode) + vars(customRules, customRuleCode)
114
114
  + sourceCode;
115
115
 
116
- if (opts.processCode) sourceCode = opts.processCode(sourceCode);
116
+ if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
117
117
  // console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
118
118
  var validate;
119
119
  try {
@@ -13,8 +13,6 @@ module.exports = {
13
13
  ucs2length: require('./ucs2length'),
14
14
  varOccurences: varOccurences,
15
15
  varReplace: varReplace,
16
- cleanUpCode: cleanUpCode,
17
- finalCleanUpCode: finalCleanUpCode,
18
16
  schemaHasRules: schemaHasRules,
19
17
  schemaHasRulesExcept: schemaHasRulesExcept,
20
18
  schemaUnknownRules: schemaUnknownRules,
@@ -36,7 +34,7 @@ function copy(o, to) {
36
34
  }
37
35
 
38
36
 
39
- function checkDataType(dataType, data, negate) {
37
+ function checkDataType(dataType, data, strictNumbers, negate) {
40
38
  var EQUAL = negate ? ' !== ' : ' === '
41
39
  , AND = negate ? ' || ' : ' && '
42
40
  , OK = negate ? '!' : ''
@@ -49,15 +47,18 @@ function checkDataType(dataType, data, negate) {
49
47
  NOT + 'Array.isArray(' + data + '))';
50
48
  case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
51
49
  NOT + '(' + data + ' % 1)' +
52
- AND + data + EQUAL + data + ')';
50
+ AND + data + EQUAL + data +
51
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
52
+ case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
53
+ (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
53
54
  default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
54
55
  }
55
56
  }
56
57
 
57
58
 
58
- function checkDataTypes(dataTypes, data) {
59
+ function checkDataTypes(dataTypes, data, strictNumbers) {
59
60
  switch (dataTypes.length) {
60
- case 1: return checkDataType(dataTypes[0], data, true);
61
+ case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
61
62
  default:
62
63
  var code = '';
63
64
  var types = toHash(dataTypes);
@@ -70,7 +71,7 @@ function checkDataTypes(dataTypes, data) {
70
71
  }
71
72
  if (types.number) delete types.integer;
72
73
  for (var t in types)
73
- code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
74
+ code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
74
75
 
75
76
  return code;
76
77
  }
@@ -136,42 +137,6 @@ function varReplace(str, dataVar, expr) {
136
137
  }
137
138
 
138
139
 
139
- var EMPTY_ELSE = /else\s*{\s*}/g
140
- , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
141
- , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
142
- function cleanUpCode(out) {
143
- return out.replace(EMPTY_ELSE, '')
144
- .replace(EMPTY_IF_NO_ELSE, '')
145
- .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
146
- }
147
-
148
-
149
- var ERRORS_REGEXP = /[^v.]errors/g
150
- , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
151
- , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
152
- , RETURN_VALID = 'return errors === 0;'
153
- , RETURN_TRUE = 'validate.errors = null; return true;'
154
- , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
155
- , RETURN_DATA_ASYNC = 'return data;'
156
- , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
157
- , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
158
-
159
- function finalCleanUpCode(out, async) {
160
- var matches = out.match(ERRORS_REGEXP);
161
- if (matches && matches.length == 2) {
162
- out = async
163
- ? out.replace(REMOVE_ERRORS_ASYNC, '')
164
- .replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
165
- : out.replace(REMOVE_ERRORS, '')
166
- .replace(RETURN_VALID, RETURN_TRUE);
167
- }
168
-
169
- matches = out.match(ROOTDATA_REGEXP);
170
- if (!matches || matches.length !== 3) return out;
171
- return out.replace(REMOVE_ROOTDATA, '');
172
- }
173
-
174
-
175
140
  function schemaHasRules(schema, rules) {
176
141
  if (typeof schema == 'boolean') return !schema;
177
142
  for (var key in schema) if (rules[key]) return true;
@@ -250,7 +215,7 @@ function getData($data, lvl, paths) {
250
215
 
251
216
  function joinPaths (a, b) {
252
217
  if (a == '""') return b;
253
- return (a + ' + ' + b).replace(/' \+ '/g, '');
218
+ return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
254
219
  }
255
220
 
256
221
 
@@ -38,7 +38,7 @@ module.exports = function (metaSchema, keywordsJsonPointers) {
38
38
  keywords[key] = {
39
39
  anyOf: [
40
40
  schema,
41
- { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
41
+ { $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
42
42
  ]
43
43
  };
44
44
  }
@@ -3,7 +3,7 @@
3
3
  var metaSchema = require('./refs/json-schema-draft-07.json');
4
4
 
5
5
  module.exports = {
6
- $id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
6
+ $id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
7
7
  definitions: {
8
8
  simpleTypes: metaSchema.definitions.simpleTypes
9
9
  },
@@ -17,6 +17,15 @@
17
17
  , $op = $isMax ? '<' : '>'
18
18
  , $notOp = $isMax ? '>' : '<'
19
19
  , $errorKeyword = undefined;
20
+
21
+ if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
22
+ throw new Error($keyword + ' must be number');
23
+ }
24
+ if (!($isDataExcl || $schemaExcl === undefined
25
+ || typeof $schemaExcl == 'number'
26
+ || typeof $schemaExcl == 'boolean')) {
27
+ throw new Error($exclusiveKeyword + ' must be number or boolean');
28
+ }
20
29
  }}
21
30
 
22
31
  {{? $isDataExcl }}
@@ -3,6 +3,8 @@
3
3
  {{# def.setupKeyword }}
4
4
  {{# def.$data }}
5
5
 
6
+ {{# def.numberKeyword }}
7
+
6
8
  {{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
7
9
  if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
8
10
  {{ var $errorKeyword = $keyword; }}
@@ -3,6 +3,8 @@
3
3
  {{# def.setupKeyword }}
4
4
  {{# def.$data }}
5
5
 
6
+ {{# def.numberKeyword }}
7
+
6
8
  {{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
7
9
  if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
8
10
  {{ var $errorKeyword = $keyword; }}
@@ -3,6 +3,8 @@
3
3
  {{# def.setupKeyword }}
4
4
  {{# def.$data }}
5
5
 
6
+ {{# def.numberKeyword }}
7
+
6
8
  {{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
7
9
  if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
8
10
  {{ var $errorKeyword = $keyword; }}
@@ -30,5 +30,3 @@
30
30
  {{= $closingBraces.slice(0,-1) }}
31
31
  {{?}}
32
32
  {{?}}
33
-
34
- {{# def.cleanUp }}
@@ -39,8 +39,6 @@
39
39
  } else {
40
40
  {{# def.resetErrors }}
41
41
  {{? it.opts.allErrors }} } {{?}}
42
-
43
- {{# def.cleanUp }}
44
42
  {{??}}
45
43
  {{? $breakOnError }}
46
44
  if (true) {
@@ -4,55 +4,45 @@
4
4
  , $coerced = 'coerced' + $lvl;
5
5
  }}
6
6
  var {{=$dataType}} = typeof {{=$data}};
7
- {{? it.opts.coerceTypes == 'array'}}
8
- if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';
9
- {{?}}
10
-
11
7
  var {{=$coerced}} = undefined;
12
8
 
13
- {{ var $bracesCoercion = ''; }}
14
- {{~ $coerceToTypes:$type:$i }}
15
- {{? $i }}
16
- if ({{=$coerced}} === undefined) {
17
- {{ $bracesCoercion += '}'; }}
18
- {{?}}
19
-
20
- {{? it.opts.coerceTypes == 'array' && $type != 'array' }}
21
- if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) {
22
- {{=$coerced}} = {{=$data}} = {{=$data}}[0];
23
- {{=$dataType}} = typeof {{=$data}};
24
- /*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/
25
- }
26
- {{?}}
9
+ {{? it.opts.coerceTypes == 'array' }}
10
+ if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
11
+ {{=$data}} = {{=$data}}[0];
12
+ {{=$dataType}} = typeof {{=$data}};
13
+ if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
14
+ }
15
+ {{?}}
27
16
 
17
+ if ({{=$coerced}} !== undefined) ;
18
+ {{~ $coerceToTypes:$type:$i }}
28
19
  {{? $type == 'string' }}
29
- if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
20
+ else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
30
21
  {{=$coerced}} = '' + {{=$data}};
31
22
  else if ({{=$data}} === null) {{=$coerced}} = '';
32
23
  {{?? $type == 'number' || $type == 'integer' }}
33
- if ({{=$dataType}} == 'boolean' || {{=$data}} === null
24
+ else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
34
25
  || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
35
26
  {{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
36
27
  {{=$coerced}} = +{{=$data}};
37
28
  {{?? $type == 'boolean' }}
38
- if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
29
+ else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
39
30
  {{=$coerced}} = false;
40
31
  else if ({{=$data}} === 'true' || {{=$data}} === 1)
41
32
  {{=$coerced}} = true;
42
33
  {{?? $type == 'null' }}
43
- if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
34
+ else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
44
35
  {{=$coerced}} = null;
45
36
  {{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
46
- if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
37
+ else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
47
38
  {{=$coerced}} = [{{=$data}}];
48
39
  {{?}}
49
40
  {{~}}
50
-
51
- {{= $bracesCoercion }}
52
-
53
- if ({{=$coerced}} === undefined) {
41
+ else {
54
42
  {{# def.error:'type' }}
55
- } else {
43
+ }
44
+
45
+ if ({{=$coerced}} !== undefined) {
56
46
  {{# def.setParentData }}
57
47
  {{=$data}} = {{=$coerced}};
58
48
  {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
@@ -53,5 +53,3 @@ var {{=$valid}};
53
53
  {{# def.resetErrors }}
54
54
  {{?}}
55
55
  {{? it.opts.allErrors }} } {{?}}
56
-
57
- {{# def.cleanUp }}
@@ -64,7 +64,8 @@
64
64
 
65
65
  {{## def.nonEmptySchema:_schema:
66
66
  (it.opts.strictKeywords
67
- ? typeof _schema == 'object' && Object.keys(_schema).length > 0
67
+ ? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
68
+ || _schema === false
68
69
  : it.util.schemaHasRules(_schema, it.RULES.all))
69
70
  #}}
70
71
 
@@ -112,12 +113,6 @@
112
113
  #}}
113
114
 
114
115
 
115
- {{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}}
116
-
117
-
118
- {{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}}
119
-
120
-
121
116
  {{## def.$data:
122
117
  {{
123
118
  var $isData = it.opts.$data && $schema && $schema.$data
@@ -144,6 +139,13 @@
144
139
  #}}
145
140
 
146
141
 
142
+ {{## def.numberKeyword:
143
+ {{? !($isData || typeof $schema == 'number') }}
144
+ {{ throw new Error($keyword + ' must be number'); }}
145
+ {{?}}
146
+ #}}
147
+
148
+
147
149
  {{## def.beginDefOut:
148
150
  {{
149
151
  var $$outStack = $$outStack || [];
@@ -19,6 +19,7 @@
19
19
  , $ownProperties = it.opts.ownProperties;
20
20
 
21
21
  for ($property in $schema) {
22
+ if ($property == '__proto__') continue;
22
23
  var $sch = $schema[$property];
23
24
  var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
24
25
  $deps[$property] = $sch;
@@ -76,5 +77,3 @@ var missing{{=$lvl}};
76
77
  {{= $closingBraces }}
77
78
  if ({{=$errs}} == errors) {
78
79
  {{?}}
79
-
80
- {{# def.cleanUp }}
@@ -65,8 +65,6 @@
65
65
  {{# def.extraError:'if' }}
66
66
  }
67
67
  {{? $breakOnError }} else { {{?}}
68
-
69
- {{# def.cleanUp }}
70
68
  {{??}}
71
69
  {{? $breakOnError }}
72
70
  if (true) {
@@ -96,5 +96,3 @@ var {{=$valid}};
96
96
  {{= $closingBraces }}
97
97
  if ({{=$errs}} == errors) {
98
98
  {{?}}
99
-
100
- {{# def.cleanUp }}
@@ -3,6 +3,8 @@
3
3
  {{# def.setupKeyword }}
4
4
  {{# def.$data }}
5
5
 
6
+ {{# def.numberKeyword }}
7
+
6
8
  var division{{=$lvl}};
7
9
  if ({{?$isData}}
8
10
  {{=$schemaValue}} !== undefined && (
@@ -28,9 +28,9 @@
28
28
  , $nextData = 'data' + $dataNxt
29
29
  , $dataProperties = 'dataProperties' + $lvl;
30
30
 
31
- var $schemaKeys = Object.keys($schema || {})
31
+ var $schemaKeys = Object.keys($schema || {}).filter(notProto)
32
32
  , $pProperties = it.schema.patternProperties || {}
33
- , $pPropertyKeys = Object.keys($pProperties)
33
+ , $pPropertyKeys = Object.keys($pProperties).filter(notProto)
34
34
  , $aProperties = it.schema.additionalProperties
35
35
  , $someProperties = $schemaKeys.length || $pPropertyKeys.length
36
36
  , $noAdditional = $aProperties === false
@@ -42,8 +42,11 @@
42
42
  , $currentBaseId = it.baseId;
43
43
 
44
44
  var $required = it.schema.required;
45
- if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired)
45
+ if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
46
46
  var $requiredHash = it.util.toHash($required);
47
+ }
48
+
49
+ function notProto(p) { return p !== '__proto__'; }
47
50
  }}
48
51
 
49
52
 
@@ -240,5 +243,3 @@ var {{=$nextValid}} = true;
240
243
  {{= $closingBraces }}
241
244
  if ({{=$errs}} == errors) {
242
245
  {{?}}
243
-
244
- {{# def.cleanUp }}
@@ -50,5 +50,3 @@ var {{=$errs}} = errors;
50
50
  {{= $closingBraces }}
51
51
  if ({{=$errs}} == errors) {
52
52
  {{?}}
53
-
54
- {{# def.cleanUp }}
@@ -38,7 +38,7 @@
38
38
  for (;i--;) {
39
39
  var item = {{=$data}}[i];
40
40
  {{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }}
41
- if ({{= it.util[$method]($itemType, 'item', true) }}) continue;
41
+ if ({{= it.util[$method]($itemType, 'item', it.opts.strictNumbers, true) }}) continue;
42
42
  {{? $typeIsArray}}
43
43
  if (typeof item == 'string') item = '"' + item;
44
44
  {{?}}
@@ -81,7 +81,7 @@
81
81
  it.baseId = it.baseId || it.rootId;
82
82
  delete it.isTop;
83
83
 
84
- it.dataPathArr = [undefined];
84
+ it.dataPathArr = [""];
85
85
 
86
86
  if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
87
87
  var $defaultMsg = 'default is ignored in the schema root';
@@ -140,7 +140,7 @@
140
140
  , $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
141
141
  }}
142
142
 
143
- if ({{= it.util[$method]($typeSchema, $data, true) }}) {
143
+ if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) {
144
144
  #}}
145
145
 
146
146
  {{? it.schema.$ref && $refKeywords }}
@@ -192,7 +192,7 @@
192
192
  {{~ it.RULES:$rulesGroup }}
193
193
  {{? $shouldUseGroup($rulesGroup) }}
194
194
  {{? $rulesGroup.type }}
195
- if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) {
195
+ if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) {
196
196
  {{?}}
197
197
  {{? it.opts.useDefaults }}
198
198
  {{? $rulesGroup.type == 'object' && it.schema.properties }}
@@ -254,12 +254,6 @@
254
254
  var {{=$valid}} = errors === errs_{{=$lvl}};
255
255
  {{?}}
256
256
 
257
- {{# def.cleanUp }}
258
-
259
- {{? $top }}
260
- {{# def.finalCleanUp }}
261
- {{?}}
262
-
263
257
  {{
264
258
  function $shouldUseGroup($rulesGroup) {
265
259
  var rules = $rulesGroup.rules;
@@ -24,6 +24,12 @@ module.exports = function generate__limit(it, $keyword, $ruleType) {
24
24
  $op = $isMax ? '<' : '>',
25
25
  $notOp = $isMax ? '>' : '<',
26
26
  $errorKeyword = undefined;
27
+ if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
28
+ throw new Error($keyword + ' must be number');
29
+ }
30
+ if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
31
+ throw new Error($exclusiveKeyword + ' must be number or boolean');
32
+ }
27
33
  if ($isDataExcl) {
28
34
  var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
29
35
  $exclusive = 'exclusive' + $lvl,
@@ -17,6 +17,9 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) {
17
17
  } else {
18
18
  $schemaValue = $schema;
19
19
  }
20
+ if (!($isData || typeof $schema == 'number')) {
21
+ throw new Error($keyword + ' must be number');
22
+ }
20
23
  var $op = $keyword == 'maxItems' ? '>' : '<';
21
24
  out += 'if ( ';
22
25
  if ($isData) {
@@ -17,6 +17,9 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) {
17
17
  } else {
18
18
  $schemaValue = $schema;
19
19
  }
20
+ if (!($isData || typeof $schema == 'number')) {
21
+ throw new Error($keyword + ' must be number');
22
+ }
20
23
  var $op = $keyword == 'maxLength' ? '>' : '<';
21
24
  out += 'if ( ';
22
25
  if ($isData) {
@@ -17,6 +17,9 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
17
17
  } else {
18
18
  $schemaValue = $schema;
19
19
  }
20
+ if (!($isData || typeof $schema == 'number')) {
21
+ throw new Error($keyword + ' must be number');
22
+ }
20
23
  var $op = $keyword == 'maxProperties' ? '>' : '<';
21
24
  out += 'if ( ';
22
25
  if ($isData) {
@@ -17,7 +17,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
17
17
  l1 = arr1.length - 1;
18
18
  while ($i < l1) {
19
19
  $sch = arr1[$i += 1];
20
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
20
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
21
21
  $allSchemasEmpty = false;
22
22
  $it.schema = $sch;
23
23
  $it.schemaPath = $schemaPath + '[' + $i + ']';
@@ -38,6 +38,5 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) {
38
38
  out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
39
39
  }
40
40
  }
41
- out = it.util.cleanUpCode(out);
42
41
  return out;
43
42
  }
@@ -15,7 +15,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
15
15
  $it.level++;
16
16
  var $nextValid = 'valid' + $it.level;
17
17
  var $noEmptySchema = $schema.every(function($sch) {
18
- return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all));
18
+ return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
19
19
  });
20
20
  if ($noEmptySchema) {
21
21
  var $currentBaseId = $it.baseId;
@@ -64,7 +64,6 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) {
64
64
  if (it.opts.allErrors) {
65
65
  out += ' } ';
66
66
  }
67
- out = it.util.cleanUpCode(out);
68
67
  } else {
69
68
  if ($breakOnError) {
70
69
  out += ' if (true) { ';
@@ -18,7 +18,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
18
18
  $dataNxt = $it.dataLevel = it.dataLevel + 1,
19
19
  $nextData = 'data' + $dataNxt,
20
20
  $currentBaseId = it.baseId,
21
- $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all));
21
+ $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
22
22
  out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
23
23
  if ($nonEmptySchema) {
24
24
  var $wasComposite = it.compositeRule;
@@ -77,6 +77,5 @@ module.exports = function generate_contains(it, $keyword, $ruleType) {
77
77
  if (it.opts.allErrors) {
78
78
  out += ' } ';
79
79
  }
80
- out = it.util.cleanUpCode(out);
81
80
  return out;
82
81
  }
@@ -17,6 +17,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
17
17
  $propertyDeps = {},
18
18
  $ownProperties = it.opts.ownProperties;
19
19
  for ($property in $schema) {
20
+ if ($property == '__proto__') continue;
20
21
  var $sch = $schema[$property];
21
22
  var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
22
23
  $deps[$property] = $sch;
@@ -142,7 +143,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
142
143
  var $currentBaseId = $it.baseId;
143
144
  for (var $property in $schemaDeps) {
144
145
  var $sch = $schemaDeps[$property];
145
- if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
146
+ if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
146
147
  out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
147
148
  if ($ownProperties) {
148
149
  out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
@@ -163,6 +164,5 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) {
163
164
  if ($breakOnError) {
164
165
  out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
165
166
  }
166
- out = it.util.cleanUpCode(out);
167
167
  return out;
168
168
  }
@@ -15,8 +15,8 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
15
15
  var $nextValid = 'valid' + $it.level;
16
16
  var $thenSch = it.schema['then'],
17
17
  $elseSch = it.schema['else'],
18
- $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)),
19
- $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)),
18
+ $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
19
+ $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
20
20
  $currentBaseId = $it.baseId;
21
21
  if ($thenPresent || $elsePresent) {
22
22
  var $ifClause;
@@ -94,7 +94,6 @@ module.exports = function generate_if(it, $keyword, $ruleType) {
94
94
  if ($breakOnError) {
95
95
  out += ' else { ';
96
96
  }
97
- out = it.util.cleanUpCode(out);
98
97
  } else {
99
98
  if ($breakOnError) {
100
99
  out += ' if (true) { ';