@prantlf/jsonlint 12.0.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -135,7 +135,7 @@ Usage: `jsonlint [options] [<file, directory, pattern> ...]`
135
135
  -S, --single-quoted-strings support single quotes as string delimiters
136
136
  -T, --trailing-commas ignore trailing commas in objects and arrays
137
137
  -D, --no-duplicate-keys report duplicate object keys as an error
138
- -V, --validate [file] JSON schema file to use for validation
138
+ -V, --validate [file] JSON Schema file to use for validation
139
139
  -e, --environment [env] which specification of JSON Schema the
140
140
  validation file uses
141
141
  -x, --context [num] line count used as the diff context (default: 3)
@@ -164,8 +164,10 @@ A pattern to exclude from processing starts with "!".
164
164
 
165
165
  Parsing mode can be "cjson" or "json5" to enable other flags automatically.
166
166
  If no files or directories are specified, stdin will be parsed. Environments
167
- for JSON schema validation are "json-schema-draft-04", "json-schema-draft-06"
168
- or "json-schema-draft-07". If not specified, it will be auto-detected.
167
+ for JSON Schema validation are "draft-04", "draft-06", "draft-07",
168
+ "draft-2019-09" or "draft-2020-12". The environment may be prefixed
169
+ with "json-schema-". JSON Type Definition can be selected by "rfc8927",
170
+ "json-type-definition" or "jtd". If not specified, it will be "draft-07".
169
171
 
170
172
  ### Configuration
171
173
 
@@ -272,21 +274,19 @@ The `mode` parameter (string) sets parsing options to match a common format of i
272
274
 
273
275
  ### Schema Validation
274
276
 
275
- You can validate the input against a JSON schema using the `lib/validator` module. The `validate` method accepts either an earlier parsed JSON data or a string with the JSON input:
277
+ You can validate the input against a JSON Schema using the `lib/validator` module. The `validate` method accepts either an earlier parsed JSON data or a string with the JSON input:
276
278
 
277
279
  ```js
278
280
  const { compile } = require('@prantlf/jsonlint/lib/validator')
279
- const validate = compile('string with JSON schema')
281
+ const validate = compile('string with JSON Schema')
280
282
  // Throws an error in case of failure.
281
283
  const parsed = validate('string with JSON data')
282
284
  ```
283
285
 
284
- If a string is passed to the `validate` method, the same options as for parsing JSON data can be passed as the second parameter. Compiling JSON schema supports the same options as parsing JSON data too (except for `reviver`). They can be passed as the second (object) parameter. The optional second `environment` parameter can be passed either as a string or as an additional property in the options object too:
286
+ If a string is passed to the `validate` method, the same options as for parsing JSON data can be passed as the second parameter. Compiling JSON Schema supports the same options as parsing JSON data too (except for `reviver`). They can be passed as the second (object) parameter. The optional second `environment` parameter can be passed either as a string or as an additional property in the options object too:
285
287
 
286
288
  ```js
287
- const validate = compile('string with JSON schema', {
288
- environment: 'json-schema-draft-04'
289
- })
289
+ const validate = compile('string with JSON Schema', { environment: 'draft-2020-12' })
290
290
  ```
291
291
 
292
292
  ### Pretty-Printing
package/lib/cli.js CHANGED
@@ -31,7 +31,7 @@ const commander = require('commander')
31
31
  .option('-S, --single-quoted-strings', 'support single quotes as string delimiters')
32
32
  .option('-T, --trailing-commas', 'ignore trailing commas in objects and arrays')
33
33
  .option('-D, --no-duplicate-keys', 'report duplicate object keys as an error')
34
- .option('-V, --validate [file]', 'JSON schema file to use for validation')
34
+ .option('-V, --validate [file]', 'JSON Schema file to use for validation')
35
35
  .option('-e, --environment [env]', 'which specification of JSON Schema the validation file uses')
36
36
  .option('-x, --context [num]', 'line count used as the diff context', 3)
37
37
  .option('-l, --log-files', 'print only the parsed file names to stdout')
@@ -55,8 +55,10 @@ const commander = require('commander')
55
55
  console.log()
56
56
  console.log('Parsing mode can be "cjson" or "json5" to enable other flags automatically.')
57
57
  console.log('If no files or directories are specified, stdin will be parsed. Environments')
58
- console.log('for JSON schema validation are "json-schema-draft-04", "json-schema-draft-06"')
59
- console.log('or "json-schema-draft-07". If not specified, it will be auto-detected.')
58
+ console.log('for JSON Schema validation are "draft-04", "draft-06", "draft-07",')
59
+ console.log('"draft-2019-09" or "draft-2020-12". The environment may be prefixed')
60
+ console.log('with "json-schema-". JSON Type Definition can be selected by "rfc8927",')
61
+ console.log('"json-type-definition" or "jtd". If not specified, it will be "draft-07".')
60
62
  })
61
63
  .parse(process.argv)
62
64
 
@@ -149,7 +151,7 @@ function processContents (source, file) {
149
151
  parserOptions.environment = options.environment
150
152
  validate = compile(schema, parserOptions)
151
153
  } catch (error) {
152
- const message = 'Loading the JSON schema failed: "' +
154
+ const message = 'Loading the JSON Schema failed: "' +
153
155
  options.validate + '".\n' + error.message
154
156
  throw new Error(message)
155
157
  }
package/lib/index.d.ts CHANGED
@@ -362,7 +362,11 @@ declare module '@prantlf/jsonlint/lib/validator' {
362
362
  /**
363
363
  * Identifiers of supported JSON Schema drafts and JSON Type Definition.
364
364
  */
365
- type Environment = 'json-schema-draft-04' | 'json-schema-draft-06' | 'json-schema-draft-07'
365
+ type Environment = 'json-schema-draft-04' | 'draft-04' |
366
+ 'json-schema-draft-06' | 'draft-06' | 'json-schema-draft-07' | 'draft-07' |
367
+ 'json-schema-draft-2019-09' | 'draft-2019-09' |
368
+ 'json-schema-draft-2020-12' | 'draft-2020-12' |
369
+ 'json-type-definition' | 'jtd' | 'rfc8927'
366
370
 
367
371
  /**
368
372
  * Options to customize a JSON Schema validator.
@@ -414,7 +418,11 @@ declare module '@prantlf/jsonlint/lib/validator' {
414
418
  /**
415
419
  * Choose the JSON Schema draft or JSON Type Definition.
416
420
  *
417
- * Available values: `'json-schema-draft-04' | 'json-schema-draft-06' | 'json-schema-draft-07'`
421
+ * Available values: `'json-schema-draft-04' | 'draft-04' |
422
+ * 'json-schema-draft-06' | 'draft-06' | 'json-schema-draft-07' | 'draft-07' |
423
+ * 'json-schema-draft-2019-09' | 'draft-2019-09' |
424
+ * 'json-schema-draft-2020-12' | 'draft-2020-12' |
425
+ * 'json-type-definition' | 'jtd' | 'rfc8927'`
418
426
  */
419
427
  environment?: Environment
420
428
  }
package/lib/validator.js CHANGED
@@ -1,31 +1,40 @@
1
1
  (function (global, factory) {
2
2
  if (typeof exports === 'object' && typeof module !== 'undefined') {
3
3
  const jsonlint = require('./jsonlint')
4
- const Ajv = require('ajv')
5
- // eslint-disable-next-line no-inner-declarations
6
- function requireSchemaDraft (environment) {
7
- return require('ajv/lib/refs/' + environment + '.json')
4
+ const ajv = {
5
+ AjvOld: 'ajv6',
6
+ Ajv07: 'ajv',
7
+ AjvJTD: 'ajv/dist/jtd',
8
+ Ajv2019: 'ajv/dist/2019',
9
+ Ajv2020: 'ajv/dist/2020',
10
+ Schema04: 'ajv6/lib/refs/json-schema-draft-04.json',
11
+ Schema06: 'ajv/dist/refs/json-schema-draft-06.json'
8
12
  }
9
- factory(exports, Ajv, jsonlint, requireSchemaDraft)
10
- // eslint-disable-next-line no-undef
13
+ const requireAjv = name => {
14
+ const exported = require(ajv[name])
15
+ return !exported.$schema && exported.default || exported
16
+ }
17
+ factory(exports, jsonlint, requireAjv)
11
18
  } else if (typeof define === 'function' && define.amd) {
12
- // eslint-disable-next-line no-undef
13
- define('jsonlint-validator', ['exports', 'ajv', 'jsonlint', 'jsonlint-schema-drafts'],
14
- function (exports, jsonlint, Ajv, schemaDrafts) {
15
- function requireSchemaDraft (environment) {
16
- return schemaDrafts[environment]
19
+ define('jsonlint-validator', ['exports', 'jsonlint', 'ajv', 'ajv7'],
20
+ function (exports, jsonlint, ajv, ajv7) {
21
+ const requireAjv = name => {
22
+ if (name === 'AjvOld') return ajv
23
+ const exported = ajv7[name]
24
+ return !exported.$schema && exported.default || exported
17
25
  }
18
- factory(exports, Ajv, jsonlint, requireSchemaDraft)
26
+ factory(exports, jsonlint, requireAjv)
19
27
  })
20
28
  } else {
21
- // eslint-disable-next-line no-undef
22
29
  global = global || self
23
- const requireSchemaDraft = function (environment) {
24
- return global.jsonlintSchemaDrafts[environment]
30
+ const requireAjv = name => {
31
+ if (name === 'AjvOld') return global.Ajv
32
+ const exported = global.ajv7[name]
33
+ return !exported.$schema && exported.default || exported
25
34
  }
26
- factory(global.jsonlintValidator = {}, global.Ajv, global.jsonlint, requireSchemaDraft)
35
+ factory(global.jsonlintValidator = {}, global.jsonlint, requireAjv)
27
36
  }
28
- }(this, function (exports, Ajv, jsonlint, requireSchemaDraft) {
37
+ }(this, function (exports, jsonlint, requireAjv) {
29
38
  'use strict'
30
39
 
31
40
  function addErrorLocation (problem, input, tokens, dataPath) {
@@ -96,24 +105,29 @@
96
105
  }
97
106
 
98
107
  function createAjv (environment) {
99
- const ajvOptions = { jsonPointers: true }
100
108
  let ajv
101
- if (!environment) {
102
- ajvOptions.schemaId = 'auto'
103
- ajv = new Ajv(ajvOptions)
104
- ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-04'))
105
- ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-06'))
106
- } else if (environment === 'json-schema-draft-07') {
107
- ajv = new Ajv(ajvOptions)
108
- } else if (environment === 'json-schema-draft-06') {
109
- ajv = new Ajv(ajvOptions)
110
- ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-06'))
111
- } else if (environment === 'json-schema-draft-04') {
112
- ajvOptions.schemaId = 'id'
113
- ajv = new Ajv(ajvOptions)
114
- ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-04'))
109
+ if (!environment || environment === 'json-schema-draft-06' || environment === 'draft-06') {
110
+ const Ajv = requireAjv('Ajv07')
111
+ ajv = new Ajv()
112
+ ajv.addMetaSchema(requireAjv('Schema06'))
113
+ } else if (environment === 'json-schema-draft-07' || environment === 'draft-07') {
114
+ const Ajv = requireAjv('Ajv07')
115
+ ajv = new Ajv()
116
+ } else if (environment === 'json-schema-draft-04' || environment === 'draft-04') {
117
+ const Ajv = requireAjv('AjvOld')
118
+ ajv = new Ajv({ schemaId: 'id' })
119
+ ajv.addMetaSchema(requireAjv('Schema04'))
120
+ } else if (environment === 'json-schema-draft-2019-09' || environment === 'draft-2019-09') {
121
+ const Ajv = requireAjv('Ajv2019')
122
+ ajv = new Ajv()
123
+ } else if (environment === 'json-schema-draft-2020-12' || environment === 'draft-2020-12') {
124
+ const Ajv = requireAjv('Ajv2020')
125
+ ajv = new Ajv()
126
+ } else if (environment === 'json-type-definition' || environment === 'jtd' || environment === 'rfc8927') {
127
+ const Ajv = requireAjv('AjvJTD')
128
+ ajv = new Ajv()
115
129
  } else {
116
- throw new RangeError('Unsupported environment for the JSON schema validation: "' +
130
+ throw new RangeError('Unsupported environment for the JSON Schema validation: "' +
117
131
  environment + '".')
118
132
  }
119
133
  return ajv
@@ -124,7 +138,7 @@
124
138
  try {
125
139
  parsed = jsonlint.parse(schema, parseOptions)
126
140
  } catch (error) {
127
- error.message = 'Parsing the JSON schema failed.\n' + error.message
141
+ error.message = 'Parsing the JSON Schema failed.\n' + error.message
128
142
  throw error
129
143
  }
130
144
  try {
@@ -134,7 +148,7 @@
134
148
  const betterError = errors
135
149
  ? createError(errors, parsed, schema, parseOptions)
136
150
  : originalError
137
- betterError.message = 'Compiling the JSON schema failed.\n' + betterError.message
151
+ betterError.message = 'Compiling the JSON Schema failed.\n' + betterError.message
138
152
  throw betterError
139
153
  }
140
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prantlf/jsonlint",
3
- "version": "12.0.0",
3
+ "version": "13.0.0",
4
4
  "description": "JSON/CJSON/JSON5 parser, syntax and schema validator and pretty-printer.",
5
5
  "author": "Ferdinand Prantl <prantlf@gmail.com> (http://prantl.tk)",
6
6
  "contributors": [
@@ -39,13 +39,11 @@
39
39
  "node": ">= 14"
40
40
  },
41
41
  "scripts": {
42
- "prepare": "npm run build",
43
- "lint": "denolint",
44
- "build": "npm run compile && npm run compile:tests",
45
- "compile": "npm run compile:jsonlint && esbuild --minify --sourcemap --outfile=web/jsonlint.min.js lib/jsonlint.js && esbuild --minify --sourcemap --outfile=web/validator.min.js lib/validator.js && esbuild --minify --sourcemap --outfile=web/formatter.min.js lib/formatter.js && esbuild --minify --sourcemap --outfile=web/sorter.min.js lib/sorter.js && esbuild --minify --sourcemap --outfile=web/printer.min.js lib/printer.js && node scripts/bundle-schema-drafts && esbuild --minify --sourcemap --outfile=web/schema-drafts.min.js lib/schema-drafts.js && esbuild --minify --sourcemap --outfile=web/ajv.min.js node_modules/ajv/dist/ajv.bundle.js",
42
+ "build": "npm run compile:jsonlint && rollup -c && npm run minify && npm run compile:tests",
46
43
  "compile:jsonlint": "cat.js src/prefix.js.txt src/unicode.js src/custom-parser.js src/pointer.js src/native-parser.js src/configurable-parser.js src/suffix.js.txt > lib/jsonlint.js",
44
+ "minify": "esbuild --minify --sourcemap --outfile=web/jsonlint.min.js lib/jsonlint.js && esbuild --minify --sourcemap --outfile=web/validator.min.js lib/validator.js && esbuild --minify --sourcemap --outfile=web/formatter.min.js lib/formatter.js && esbuild --minify --sourcemap --outfile=web/sorter.min.js lib/sorter.js && esbuild --minify --sourcemap --outfile=web/printer.min.js lib/printer.js && esbuild --minify --sourcemap --outfile=web/ajv.min.js node_modules/ajv6/dist/ajv.bundle.js",
47
45
  "compile:tests": "tsc --moduleResolution node --module es2022 test/types.test.ts && mv.js test/types.test.js test/types.test.mjs",
48
- "test": "npm run lint && c8 node test/types.test.mjs && c8 --no-clean node test/parse1 && c8 --no-clean node test/parse1 --native-parser && c8 --no-clean node test/parse2 && c8 --no-clean node test/parse3 && c8 --no-clean node test/parse4 && c8 --no-clean node test/parse5 && c8 --no-clean node test/portable && c8 --no-clean node test/tokenize && c8 --no-clean node test/print && c8 --no-clean node lib/cli package.json test/recursive && c8 --no-clean node lib/cli -sq test/passes/hasOwnProperty.json && c8 --no-clean node lib/cli -s -e json-schema-draft-04 -V test/passes/3.schema.json test/passes/3.json && c8 --no-clean node lib/cli -C test/passes/comments.txt && c8 --no-clean node lib/cli -pS test/passes/strings.txt && c8 --no-clean node lib/cli -M json5 test/passes/json5.text && c8 --no-clean node lib/cli -v && c8 --no-clean node lib/cli -h && c8 --no-clean node lib/cli -Pc test/fails/10.json || c8 --no-clean node lib/cli -f test/.jsonrc.yml 'test/**/*.json' '!**/fails' && c8 report",
46
+ "test": "denolint && c8 node test/types.test.mjs && c8 --no-clean node test/parse1 && c8 --no-clean node test/parse1 --native-parser && c8 --no-clean node test/parse2 && c8 --no-clean node test/parse3 && c8 --no-clean node test/parse4 && c8 --no-clean node test/parse5 && c8 --no-clean node test/portable && c8 --no-clean node test/tokenize && c8 --no-clean node test/print && c8 --no-clean node lib/cli package.json test/recursive && c8 --no-clean node lib/cli -sq test/passes/hasOwnProperty.json && c8 --no-clean node lib/cli -s -e json-schema-draft-04 -V test/passes/schema-04.json test/passes/data-04.json && c8 --no-clean node lib/cli -s -e json-schema-draft-07 -V test/passes/schema-07.json test/passes/data-07.json && c8 --no-clean node lib/cli -C test/passes/comments.txt && c8 --no-clean node lib/cli -pS test/passes/strings.txt && c8 --no-clean node lib/cli -M json5 test/passes/json5.text && c8 --no-clean node lib/cli -v && c8 --no-clean node lib/cli -h && c8 --no-clean node lib/cli -Pc test/fails/10.json || c8 --no-clean node lib/cli -f test/.jsonrc.yml 'test/**/*.json' '!**/fails' && c8 report",
49
47
  "start": "http-server -c 5",
50
48
  "web": "npm run web:sync && npm run web:deploy",
51
49
  "web:clone": "test ! -d ../jsonlint-pages && git clone --single-branch --branch gh-pages `git remote get-url origin` ../jsonlint-pages",
@@ -75,13 +73,17 @@
75
73
  ]
76
74
  },
77
75
  "dependencies": {
78
- "ajv": "6.12.6",
76
+ "ajv": "8.12.0",
77
+ "ajv6": "npm:ajv@6.12.6",
79
78
  "commander": "10.0.0",
80
79
  "cosmiconfig": "8.1.0",
81
80
  "diff": "5.1.0",
82
81
  "fast-glob": "3.2.12"
83
82
  },
84
83
  "devDependencies": {
84
+ "@rollup/plugin-commonjs": "24.0.1",
85
+ "@rollup/plugin-json": "6.0.0",
86
+ "@rollup/plugin-node-resolve": "15.0.1",
85
87
  "@semantic-release/changelog": "6.0.2",
86
88
  "@semantic-release/git": "10.0.1",
87
89
  "@types/node": "18.14.6",
@@ -92,6 +94,8 @@
92
94
  "esbuild": "0.17.11",
93
95
  "http-server": "14.1.1",
94
96
  "js-yaml": "4.1.0",
97
+ "rollup": "3.18.0",
98
+ "rollup-plugin-swc-minify": "1.0.5",
95
99
  "tehanu": "1.0.1",
96
100
  "tehanu-repo-coco": "1.0.0",
97
101
  "tehanu-teru": "1.0.0",
package/web/jsonlint.html CHANGED
@@ -46,6 +46,12 @@
46
46
  flex-basis: calc(50% - 1ex);
47
47
  min-width: calc(42ex - 3ex);
48
48
  }
49
+ #environment {
50
+ display: none;
51
+ }
52
+ .with-schema #environment {
53
+ display: inline-block;
54
+ }
49
55
  #options > * {
50
56
  display: flex;
51
57
  flex-wrap: wrap;
@@ -83,14 +89,14 @@
83
89
  </header>
84
90
  <main>
85
91
  <section>
86
- <form aria-label="Source">
92
+ <form aria-label="Source" id="form">
87
93
  <div id="source">
88
94
  <div id="data-section">
89
95
  <label for="data">Data:</label>
90
96
  <textarea id="data" rows="10" cols="40"></textarea>
91
97
  </div>
92
98
  <div id="schema-section">
93
- <label for="schema">Schema (only drafts 04, 06 or 07):</label>
99
+ <label for="schema">Schema:</label>
94
100
  <textarea id="schema" rows="10" cols="40"></textarea>
95
101
  </div>
96
102
  </div>
@@ -167,6 +173,16 @@
167
173
  <input type="checkbox" id="with-schema">
168
174
  <label for="with-schema">Use JSON Schema</label>
169
175
  </div>
176
+ <div>
177
+ <select id="environment" aria-label="JSON Schema Environment">
178
+ <option value="draft-04">JSON Schema draft 04</option>
179
+ <option value="draft-06">JSON Schema draft 06</option>
180
+ <option value="draft-07" selected>JSON Schema draft 07</option>
181
+ <option value="draft-2019-09">JSON Schema draft 2019-09</option>
182
+ <option value="draft-2020-12">JSON Schema draft 2020-12</option>
183
+ <option value="jtd">JSON Type Definition</option>
184
+ </select>
185
+ </div>
170
186
  </div>
171
187
  </div>
172
188
  <button id="validate" type="button">Validate</button>
@@ -187,7 +203,7 @@
187
203
  <script src="sorter.min.js" defer></script>
188
204
  <script src="printer.min.js" defer></script>
189
205
  <script src="ajv.min.js" defer></script>
190
- <script src="schema-drafts.min.js" defer></script>
206
+ <script src="ajv7.min.js" defer></script>
191
207
  <script src="validator.min.js" defer></script>
192
208
  <script defer>
193
209
  window.onload = function () {
@@ -218,7 +234,7 @@
218
234
  function toggleSchemaValidation () {
219
235
  var className = document.getElementById('with-schema').checked
220
236
  ? 'with-schema' : ''
221
- document.getElementById('source').className = className
237
+ document.getElementById('form').className = className
222
238
  }
223
239
 
224
240
  function selectParsingExtension () {
@@ -286,7 +302,10 @@
286
302
  function parseInput (source, parserOptions) {
287
303
  if (document.getElementById('with-schema').checked) {
288
304
  var schema = document.getElementById('schema').value
289
- var validate = jsonlintValidator.compile(schema, parserOptions)
305
+ var validate = jsonlintValidator.compile(schema, {
306
+ environment: document.getElementById('environment').value,
307
+ ...parserOptions
308
+ })
290
309
  return validate(source, parserOptions)
291
310
  }
292
311
  return jsonlint.parse(source, parserOptions)
@@ -1,4 +1,4 @@
1
- (function(f,d){if(typeof exports=="object"&&typeof module<"u"){let u=function(h){return require("ajv/lib/refs/"+h+".json")};var g=u;const i=require("./jsonlint"),l=require("ajv");d(exports,l,i,u)}else if(typeof define=="function"&&define.amd)define("jsonlint-validator",["exports","ajv","jsonlint","jsonlint-schema-drafts"],function(i,l,u,h){function S(w){return h[w]}d(i,u,l,S)});else{f=f||self;const i=function(l){return f.jsonlintSchemaDrafts[l]};d(f.jsonlintValidator={},f.Ajv,f.jsonlint,i)}})(this,function(f,d,g,i){"use strict";function l(t,n,e,r){const a=e.find(function(o){return r===g.pathToPointer(o.path)});if(a){const o=a.location.start,s=o.offset,c=o.line,m=o.column,j=g.getErrorTexts(t.reason,n,s,c,m);return t.message=j.message,t.excerpt=j.excerpt,j.pointer&&(t.pointer=j.pointer,t.location={start:{column:m,line:c,offset:s}}),!0}}function u(t,n,e){const r=t.dataPath,a=t.schemaPath,o=(r||"/")+" "+t.message+"; see "+a,s={reason:o,dataPath:r,schemaPath:a};return l(s,n,e,r)||(s.message=o),s}function h(t,n,e,r){e||(e=JSON.stringify(n,void 0,2)),r||(r={}),Object.assign(r,{tokenLocations:!0,tokenPaths:!0});const a=g.tokenize(e,r),o=u(t[0],e,a),s=new SyntaxError(o.message);return Object.assign(s,o),s}function S(t){const n={jsonPointers:!0};let e;if(!t)n.schemaId="auto",e=new d(n),e.addMetaSchema(i("json-schema-draft-04")),e.addMetaSchema(i("json-schema-draft-06"));else if(t==="json-schema-draft-07")e=new d(n);else if(t==="json-schema-draft-06")e=new d(n),e.addMetaSchema(i("json-schema-draft-06"));else if(t==="json-schema-draft-04")n.schemaId="id",e=new d(n),e.addMetaSchema(i("json-schema-draft-04"));else throw new RangeError('Unsupported environment for the JSON schema validation: "'+t+'".');return e}function w(t,n,e){let r;try{r=g.parse(n,e)}catch(a){throw a.message=`Parsing the JSON schema failed.
2
- `+a.message,a}try{return t.compile(r)}catch(a){const o=t.errors,s=o?h(o,r,n,e):a;throw s.message=`Compiling the JSON schema failed.
3
- `+s.message,s}}function p(t,n){let e={};typeof n=="object"&&!(n instanceof String)&&(e=n,n=e.environment);const r=S(n),a={mode:e.mode,ignoreBOM:e.ignoreBOM,ignoreComments:e.ignoreComments,ignoreTrailingCommas:e.ignoreTrailingCommas,allowSingleQuotedStrings:e.allowSingleQuotedStrings,allowDuplicateObjectKeys:e.allowDuplicateObjectKeys},o=w(r,t,a);return function(s,c,m){if(typeof s=="string"||s instanceof String?(m=c,c=s,s=g.parse(c,m)):typeof c=="string"||c instanceof String||(m=c,c=void 0),o(s))return s;throw h(o.errors,s,c,m)}}f.compile=p,Object.defineProperty(f,"__esModule",{value:!0})});
1
+ (function(f,d){if(typeof exports=="object"&&typeof module<"u"){const n=require("./jsonlint"),l={AjvOld:"ajv6",Ajv07:"ajv",AjvJTD:"ajv/dist/jtd",Ajv2019:"ajv/dist/2019",Ajv2020:"ajv/dist/2020",Schema04:"ajv6/lib/refs/json-schema-draft-04.json",Schema06:"ajv/dist/refs/json-schema-draft-06.json"},j=u=>{const m=require(l[u]);return!m.$schema&&m.default||m};d(exports,n,j)}else if(typeof define=="function"&&define.amd)define("jsonlint-validator",["exports","jsonlint","ajv","ajv7"],function(n,l,j,u){d(n,l,S=>{if(S==="AjvOld")return j;const g=u[S];return!g.$schema&&g.default||g})});else{f=f||self;const n=l=>{if(l==="AjvOld")return f.Ajv;const j=f.ajv7[l];return!j.$schema&&j.default||j};d(f.jsonlintValidator={},f.jsonlint,n)}})(this,function(f,d,n){"use strict";function l(e,s,t,a){const c=t.find(function(r){return a===d.pathToPointer(r.path)});if(c){const r=c.location.start,o=r.offset,i=r.line,h=r.column,v=d.getErrorTexts(e.reason,s,o,i,h);return e.message=v.message,e.excerpt=v.excerpt,v.pointer&&(e.pointer=v.pointer,e.location={start:{column:h,line:i,offset:o}}),!0}}function j(e,s,t){const a=e.dataPath,c=e.schemaPath,r=(a||"/")+" "+e.message+"; see "+c,o={reason:r,dataPath:a,schemaPath:c};return l(o,s,t,a)||(o.message=r),o}function u(e,s,t,a){t||(t=JSON.stringify(s,void 0,2)),a||(a={}),Object.assign(a,{tokenLocations:!0,tokenPaths:!0});const c=d.tokenize(t,a),r=j(e[0],t,c),o=new SyntaxError(r.message);return Object.assign(o,r),o}function m(e){let s;if(!e||e==="json-schema-draft-06"||e==="draft-06"){const t=n("Ajv07");s=new t,s.addMetaSchema(n("Schema06"))}else if(e==="json-schema-draft-07"||e==="draft-07"){const t=n("Ajv07");s=new t}else if(e==="json-schema-draft-04"||e==="draft-04"){const t=n("AjvOld");s=new t({schemaId:"id"}),s.addMetaSchema(n("Schema04"))}else if(e==="json-schema-draft-2019-09"||e==="draft-2019-09"){const t=n("Ajv2019");s=new t}else if(e==="json-schema-draft-2020-12"||e==="draft-2020-12"){const t=n("Ajv2020");s=new t}else if(e==="json-type-definition"||e==="jtd"||e==="rfc8927"){const t=n("AjvJTD");s=new t}else throw new RangeError('Unsupported environment for the JSON Schema validation: "'+e+'".');return s}function S(e,s,t){let a;try{a=d.parse(s,t)}catch(c){throw c.message=`Parsing the JSON Schema failed.
2
+ `+c.message,c}try{return e.compile(a)}catch(c){const r=e.errors,o=r?u(r,a,s,t):c;throw o.message=`Compiling the JSON Schema failed.
3
+ `+o.message,o}}function g(e,s){let t={};typeof s=="object"&&!(s instanceof String)&&(t=s,s=t.environment);const a=m(s),c={mode:t.mode,ignoreBOM:t.ignoreBOM,ignoreComments:t.ignoreComments,ignoreTrailingCommas:t.ignoreTrailingCommas,allowSingleQuotedStrings:t.allowSingleQuotedStrings,allowDuplicateObjectKeys:t.allowDuplicateObjectKeys},r=S(a,e,c);return function(o,i,h){if(typeof o=="string"||o instanceof String?(h=i,i=o,o=d.parse(i,h)):typeof i=="string"||i instanceof String||(h=i,i=void 0),r(o))return o;throw u(r.errors,o,i,h)}}f.compile=g,Object.defineProperty(f,"__esModule",{value:!0})});
4
4
  //# sourceMappingURL=validator.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/validator.js"],
4
- "sourcesContent": ["(function (global, factory) {\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n const jsonlint = require('./jsonlint')\n const Ajv = require('ajv')\n // eslint-disable-next-line no-inner-declarations\n function requireSchemaDraft (environment) {\n return require('ajv/lib/refs/' + environment + '.json')\n }\n factory(exports, Ajv, jsonlint, requireSchemaDraft)\n // eslint-disable-next-line no-undef\n } else if (typeof define === 'function' && define.amd) {\n // eslint-disable-next-line no-undef\n define('jsonlint-validator', ['exports', 'ajv', 'jsonlint', 'jsonlint-schema-drafts'],\n function (exports, jsonlint, Ajv, schemaDrafts) {\n function requireSchemaDraft (environment) {\n return schemaDrafts[environment]\n }\n factory(exports, Ajv, jsonlint, requireSchemaDraft)\n })\n } else {\n // eslint-disable-next-line no-undef\n global = global || self\n const requireSchemaDraft = function (environment) {\n return global.jsonlintSchemaDrafts[environment]\n }\n factory(global.jsonlintValidator = {}, global.Ajv, global.jsonlint, requireSchemaDraft)\n }\n}(this, function (exports, Ajv, jsonlint, requireSchemaDraft) {\n 'use strict'\n\n function addErrorLocation (problem, input, tokens, dataPath) {\n const token = tokens.find(function (token) {\n return dataPath === jsonlint.pathToPointer(token.path)\n })\n if (token) {\n const location = token.location.start\n const offset = location.offset\n const line = location.line\n const column = location.column\n const texts = jsonlint.getErrorTexts(problem.reason, input, offset, line, column)\n problem.message = texts.message\n problem.excerpt = texts.excerpt\n if (texts.pointer) {\n problem.pointer = texts.pointer\n problem.location = {\n start: {\n column,\n line,\n offset\n }\n }\n }\n return true\n }\n }\n\n function errorToProblem (error, input, tokens) {\n const dataPath = error.dataPath\n const schemaPath = error.schemaPath\n const reason = (dataPath || '/') + ' ' + error.message + '; see ' + schemaPath\n const problem = {\n reason,\n dataPath,\n schemaPath\n }\n if (!addErrorLocation(problem, input, tokens, dataPath)) {\n problem.message = reason\n }\n return problem\n }\n\n function createError (errors, data, input, options) {\n if (!input) {\n input = JSON.stringify(data, undefined, 2)\n }\n if (!options) {\n options = {}\n }\n Object.assign(options, {\n tokenLocations: true,\n tokenPaths: true\n })\n const tokens = jsonlint.tokenize(input, options)\n // var problems = errors.map(function (error) {\n // return errorToProblem(error, input, tokens)\n // })\n // var message = problems\n // .map(function (problem) {\n // return problem.message\n // })\n // .join('\\n')\n const problem = errorToProblem(errors[0], input, tokens)\n const error = new SyntaxError(problem.message)\n Object.assign(error, problem)\n return error\n }\n\n function createAjv (environment) {\n const ajvOptions = { jsonPointers: true }\n let ajv\n if (!environment) {\n ajvOptions.schemaId = 'auto'\n ajv = new Ajv(ajvOptions)\n ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-04'))\n ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-06'))\n } else if (environment === 'json-schema-draft-07') {\n ajv = new Ajv(ajvOptions)\n } else if (environment === 'json-schema-draft-06') {\n ajv = new Ajv(ajvOptions)\n ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-06'))\n } else if (environment === 'json-schema-draft-04') {\n ajvOptions.schemaId = 'id'\n ajv = new Ajv(ajvOptions)\n ajv.addMetaSchema(requireSchemaDraft('json-schema-draft-04'))\n } else {\n throw new RangeError('Unsupported environment for the JSON schema validation: \"' +\n environment + '\".')\n }\n return ajv\n }\n\n function compileSchema (ajv, schema, parseOptions) {\n let parsed\n try {\n parsed = jsonlint.parse(schema, parseOptions)\n } catch (error) {\n error.message = 'Parsing the JSON schema failed.\\n' + error.message\n throw error\n }\n try {\n return ajv.compile(parsed)\n } catch (originalError) {\n const errors = ajv.errors\n const betterError = errors\n ? createError(errors, parsed, schema, parseOptions)\n : originalError\n betterError.message = 'Compiling the JSON schema failed.\\n' + betterError.message\n throw betterError\n }\n }\n\n function compile (schema, environment) {\n let options = {}\n if (typeof environment === 'object' && !(environment instanceof String)) {\n options = environment\n environment = options.environment\n }\n const ajv = createAjv(environment)\n const parseOptions = {\n mode: options.mode,\n ignoreBOM: options.ignoreBOM,\n ignoreComments: options.ignoreComments,\n ignoreTrailingCommas: options.ignoreTrailingCommas,\n allowSingleQuotedStrings: options.allowSingleQuotedStrings,\n allowDuplicateObjectKeys: options.allowDuplicateObjectKeys\n }\n const validate = compileSchema(ajv, schema, parseOptions)\n return function (data, input, options) {\n if (typeof data === 'string' || data instanceof String) {\n options = input\n input = data\n data = jsonlint.parse(input, options)\n } else if (!(typeof input === 'string' || input instanceof String)) {\n options = input\n input = undefined\n }\n if (validate(data)) {\n return data\n }\n throw createError(validate.errors, data, input, options)\n }\n }\n\n exports.compile = compile\n\n Object.defineProperty(exports, '__esModule', { value: true })\n}))\n"],
5
- "mappings": "CAAC,SAAUA,EAAQC,EAAS,CAC1B,GAAI,OAAO,SAAY,UAAY,OAAO,OAAW,IAAa,CAIhE,IAASC,EAAT,SAA6BC,EAAa,CACxC,OAAO,QAAQ,gBAAkBA,EAAc,OAAO,CACxD,EAFS,IAAAD,IAHT,MAAME,EAAW,QAAQ,YAAY,EAC/BC,EAAM,QAAQ,KAAK,EAKzBJ,EAAQ,QAASI,EAAKD,EAAUF,CAAkB,UAEzC,OAAO,QAAW,YAAc,OAAO,IAEhD,OAAO,qBAAsB,CAAC,UAAW,MAAO,WAAY,wBAAwB,EAClF,SAAUI,EAASF,EAAUC,EAAKE,EAAc,CAC9C,SAASL,EAAoBC,EAAa,CACxC,OAAOI,EAAaJ,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ASL,EAAQ5B,EAAa,CACrC,IAAIuB,EAAU,CAAC,EACX,OAAOvB,GAAgB,UAAY,EAAEA,aAAuB,UAC9DuB,EAAUvB,EACVA,EAAcuB,EAAQ,aAExB,MAAMG,EAAMF,EAAUxB,CAAW,EAC3B6B,EAAe,CACnB,KAAMN,EAAQ,KACd,UAAWA,EAAQ,UACnB,eAAgBA,EAAQ,eACxB,qBAAsBA,EAAQ,qBAC9B,yBAA0BA,EAAQ,yBAClC,yBAA0BA,EAAQ,wBACpC,EACMW,EAAWP,EAAcD,EAAKE,EAAQC,CAAY,EACxD,OAAO,SAAUP,EAAMf,EAAOgB,EAAS,CASrC,GARI,OAAOD,GAAS,UAAYA,aAAgB,QAC9CC,EAAUhB,EACVA,EAAQe,EACRA,EAAOrB,EAAS,MAAMM,EAAOgB,CAAO,GACzB,OAAOhB,GAAU,UAAYA,aAAiB,SACzDgB,EAAUhB,EACVA,EAAQ,QAEN2B,EAASZ,CAAI,EACf,OAAOA,EAET,MAAMF,EAAYc,EAAS,OAAQZ,EAAMf,EAAOgB,CAAO,CACzD,CACF,CAEApB,EAAQ,QAAU8B,EAElB,OAAO,eAAe9B,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,CAC9D,CAAC",
6
- "names": ["global", "factory", "requireSchemaDraft", "environment", "jsonlint", "Ajv", "exports", "schemaDrafts", "addErrorLocation", "problem", "input", "tokens", "dataPath", "token", "location", "offset", "line", "column", "texts", "errorToProblem", "error", "schemaPath", "reason", "createError", "errors", "data", "options", "createAjv", "ajvOptions", "ajv", "compileSchema", "schema", "parseOptions", "parsed", "originalError", "betterError", "compile", "validate"]
4
+ "sourcesContent": ["(function (global, factory) {\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n const jsonlint = require('./jsonlint')\n const ajv = {\n AjvOld: 'ajv6',\n Ajv07: 'ajv',\n AjvJTD: 'ajv/dist/jtd',\n Ajv2019: 'ajv/dist/2019',\n Ajv2020: 'ajv/dist/2020',\n Schema04: 'ajv6/lib/refs/json-schema-draft-04.json',\n Schema06: 'ajv/dist/refs/json-schema-draft-06.json'\n }\n const requireAjv = name => {\n const exported = require(ajv[name])\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n } else if (typeof define === 'function' && define.amd) {\n define('jsonlint-validator', ['exports', 'jsonlint', 'ajv', 'ajv7'],\n function (exports, jsonlint, ajv, ajv7) {\n const requireAjv = name => {\n if (name === 'AjvOld') return ajv\n const exported = ajv7[name]\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n })\n } else {\n global = global || self\n const requireAjv = name => {\n if (name === 'AjvOld') return global.Ajv\n const exported = global.ajv7[name]\n return !exported.$schema && exported.default || exported\n }\n factory(global.jsonlintValidator = {}, global.jsonlint, requireAjv)\n }\n}(this, function (exports, jsonlint, requireAjv) {\n 'use strict'\n\n function addErrorLocation (problem, input, tokens, dataPath) {\n const token = tokens.find(function (token) {\n return dataPath === jsonlint.pathToPointer(token.path)\n })\n if (token) {\n const location = token.location.start\n const offset = location.offset\n const line = location.line\n const column = location.column\n const texts = jsonlint.getErrorTexts(problem.reason, input, offset, line, column)\n problem.message = texts.message\n problem.excerpt = texts.excerpt\n if (texts.pointer) {\n problem.pointer = texts.pointer\n problem.location = {\n start: {\n column,\n line,\n offset\n }\n }\n }\n return true\n }\n }\n\n function errorToProblem (error, input, tokens) {\n const dataPath = error.dataPath\n const schemaPath = error.schemaPath\n const reason = (dataPath || '/') + ' ' + error.message + '; see ' + schemaPath\n const problem = {\n reason,\n dataPath,\n schemaPath\n }\n if (!addErrorLocation(problem, input, tokens, dataPath)) {\n problem.message = reason\n }\n return problem\n }\n\n function createError (errors, data, input, options) {\n if (!input) {\n input = JSON.stringify(data, undefined, 2)\n }\n if (!options) {\n options = {}\n }\n Object.assign(options, {\n tokenLocations: true,\n tokenPaths: true\n })\n const tokens = jsonlint.tokenize(input, options)\n // var problems = errors.map(function (error) {\n // return errorToProblem(error, input, tokens)\n // })\n // var message = problems\n // .map(function (problem) {\n // return problem.message\n // })\n // .join('\\n')\n const problem = errorToProblem(errors[0], input, tokens)\n const error = new SyntaxError(problem.message)\n Object.assign(error, problem)\n return error\n }\n\n function createAjv (environment) {\n let ajv\n if (!environment || environment === 'json-schema-draft-06' || environment === 'draft-06') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n ajv.addMetaSchema(requireAjv('Schema06'))\n } else if (environment === 'json-schema-draft-07' || environment === 'draft-07') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-04' || environment === 'draft-04') {\n const Ajv = requireAjv('AjvOld')\n ajv = new Ajv({ schemaId: 'id' })\n ajv.addMetaSchema(requireAjv('Schema04'))\n } else if (environment === 'json-schema-draft-2019-09' || environment === 'draft-2019-09') {\n const Ajv = requireAjv('Ajv2019')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-2020-12' || environment === 'draft-2020-12') {\n const Ajv = requireAjv('Ajv2020')\n ajv = new Ajv()\n } else if (environment === 'json-type-definition' || environment === 'jtd' || environment === 'rfc8927') {\n const Ajv = requireAjv('AjvJTD')\n ajv = new Ajv()\n } else {\n throw new RangeError('Unsupported environment for the JSON Schema validation: \"' +\n environment + '\".')\n }\n return ajv\n }\n\n function compileSchema (ajv, schema, parseOptions) {\n let parsed\n try {\n parsed = jsonlint.parse(schema, parseOptions)\n } catch (error) {\n error.message = 'Parsing the JSON Schema failed.\\n' + error.message\n throw error\n }\n try {\n return ajv.compile(parsed)\n } catch (originalError) {\n const errors = ajv.errors\n const betterError = errors\n ? createError(errors, parsed, schema, parseOptions)\n : originalError\n betterError.message = 'Compiling the JSON Schema failed.\\n' + betterError.message\n throw betterError\n }\n }\n\n function compile (schema, environment) {\n let options = {}\n if (typeof environment === 'object' && !(environment instanceof String)) {\n options = environment\n environment = options.environment\n }\n const ajv = createAjv(environment)\n const parseOptions = {\n mode: options.mode,\n ignoreBOM: options.ignoreBOM,\n ignoreComments: options.ignoreComments,\n ignoreTrailingCommas: options.ignoreTrailingCommas,\n allowSingleQuotedStrings: options.allowSingleQuotedStrings,\n allowDuplicateObjectKeys: options.allowDuplicateObjectKeys\n }\n const validate = compileSchema(ajv, schema, parseOptions)\n return function (data, input, options) {\n if (typeof data === 'string' || data instanceof String) {\n options = input\n input = data\n data = jsonlint.parse(input, options)\n } else if (!(typeof input === 'string' || input instanceof String)) {\n options = input\n input = undefined\n }\n if (validate(data)) {\n return data\n }\n throw createError(validate.errors, data, input, options)\n }\n }\n\n exports.compile = compile\n\n Object.defineProperty(exports, '__esModule', { value: true })\n}))\n"],
5
+ "mappings": "CAAC,SAAUA,EAAQC,EAAS,CAC1B,GAAI,OAAO,SAAY,UAAY,OAAO,OAAW,IAAa,CAChE,MAAMC,EAAW,QAAQ,YAAY,EAC/BC,EAAM,CACV,OAAQ,OACR,MAAO,MACP,OAAQ,eACR,QAAS,gBACT,QAAS,gBACT,SAAU,0CACV,SAAU,yCACZ,EACMC,EAAaC,GAAQ,CACzB,MAAMC,EAAW,QAAQH,EAAIE,CAAI,CAAC,EAClC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQ,QAASC,EAAUE,CAAU,UAC5B,OAAO,QAAW,YAAc,OAAO,IAChD,OAAO,qBAAsB,CAAC,UAAW,WAAY,MAAO,MAAM,EAChE,SAAUG,EAASL,EAAUC,EAAKK,EAAM,CAMtCP,EAAQM,EAASL,EALEG,GAAQ,CACzB,GAAIA,IAAS,SAAU,OAAOF,EAC9B,MAAMG,EAAWE,EAAKH,CAAI,EAC1B,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,CACqC,CACvC,CAAC,MACE,CACLN,EAASA,GAAU,KACnB,MAAMI,EAAaC,GAAQ,CACzB,GAAIA,IAAS,SAAU,OAAOL,EAAO,IACrC,MAAMM,EAAWN,EAAO,KAAKK,CAAI,EACjC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQ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AAY,QAAU;AAAA,EAAwCA,EAAY,QACpEA,CACR,CACF,CAEA,SAASC,EAASL,EAAQH,EAAa,CACrC,IAAIF,EAAU,CAAC,EACX,OAAOE,GAAgB,UAAY,EAAEA,aAAuB,UAC9DF,EAAUE,EACVA,EAAcF,EAAQ,aAExB,MAAMxB,EAAMyB,EAAUC,CAAW,EAC3BI,EAAe,CACnB,KAAMN,EAAQ,KACd,UAAWA,EAAQ,UACnB,eAAgBA,EAAQ,eACxB,qBAAsBA,EAAQ,qBAC9B,yBAA0BA,EAAQ,yBAClC,yBAA0BA,EAAQ,wBACpC,EACMW,EAAWP,EAAc5B,EAAK6B,EAAQC,CAAY,EACxD,OAAO,SAAUP,EAAMf,EAAOgB,EAAS,CASrC,GARI,OAAOD,GAAS,UAAYA,aAAgB,QAC9CC,EAAUhB,EACVA,EAAQe,EACRA,EAAOxB,EAAS,MAAMS,EAAOgB,CAAO,GACzB,OAAOhB,GAAU,UAAYA,aAAiB,SACzDgB,EAAUhB,EACVA,EAAQ,QAEN2B,EAASZ,CAAI,EACf,OAAOA,EAET,MAAMF,EAAYc,EAAS,OAAQZ,EAAMf,EAAOgB,CAAO,CACzD,CACF,CAEApB,EAAQ,QAAU8B,EAElB,OAAO,eAAe9B,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,CAC9D,CAAC",
6
+ "names": ["global", "factory", "jsonlint", "ajv", "requireAjv", "name", "exported", "exports", "ajv7", "addErrorLocation", "problem", "input", "tokens", "dataPath", "token", "location", "offset", "line", "column", "texts", "errorToProblem", "error", "schemaPath", "reason", "createError", "errors", "data", "options", "createAjv", "environment", "Ajv", "compileSchema", "schema", "parseOptions", "parsed", "originalError", "betterError", "compile", "validate"]
7
7
  }
@@ -1,482 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports)
3
- : typeof define === 'function' && define.amd ? define('jsonlintSchemaDrafts', ['exports'], factory)
4
- : (global = global || self, factory(global.jsonlintSchemaDrafts = {}));
5
- }(this, function (exports) { 'use strict';
6
-
7
- exports["json-schema-draft-04"] = {
8
- "id": "http://json-schema.org/draft-04/schema#",
9
- "$schema": "http://json-schema.org/draft-04/schema#",
10
- "description": "Core schema meta-schema",
11
- "definitions": {
12
- "schemaArray": {
13
- "type": "array",
14
- "minItems": 1,
15
- "items": { "$ref": "#" }
16
- },
17
- "positiveInteger": {
18
- "type": "integer",
19
- "minimum": 0
20
- },
21
- "positiveIntegerDefault0": {
22
- "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
23
- },
24
- "simpleTypes": {
25
- "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
26
- },
27
- "stringArray": {
28
- "type": "array",
29
- "items": { "type": "string" },
30
- "minItems": 1,
31
- "uniqueItems": true
32
- }
33
- },
34
- "type": "object",
35
- "properties": {
36
- "id": {
37
- "type": "string"
38
- },
39
- "$schema": {
40
- "type": "string"
41
- },
42
- "title": {
43
- "type": "string"
44
- },
45
- "description": {
46
- "type": "string"
47
- },
48
- "default": {},
49
- "multipleOf": {
50
- "type": "number",
51
- "minimum": 0,
52
- "exclusiveMinimum": true
53
- },
54
- "maximum": {
55
- "type": "number"
56
- },
57
- "exclusiveMaximum": {
58
- "type": "boolean",
59
- "default": false
60
- },
61
- "minimum": {
62
- "type": "number"
63
- },
64
- "exclusiveMinimum": {
65
- "type": "boolean",
66
- "default": false
67
- },
68
- "maxLength": { "$ref": "#/definitions/positiveInteger" },
69
- "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
70
- "pattern": {
71
- "type": "string",
72
- "format": "regex"
73
- },
74
- "additionalItems": {
75
- "anyOf": [
76
- { "type": "boolean" },
77
- { "$ref": "#" }
78
- ],
79
- "default": {}
80
- },
81
- "items": {
82
- "anyOf": [
83
- { "$ref": "#" },
84
- { "$ref": "#/definitions/schemaArray" }
85
- ],
86
- "default": {}
87
- },
88
- "maxItems": { "$ref": "#/definitions/positiveInteger" },
89
- "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
90
- "uniqueItems": {
91
- "type": "boolean",
92
- "default": false
93
- },
94
- "maxProperties": { "$ref": "#/definitions/positiveInteger" },
95
- "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
96
- "required": { "$ref": "#/definitions/stringArray" },
97
- "additionalProperties": {
98
- "anyOf": [
99
- { "type": "boolean" },
100
- { "$ref": "#" }
101
- ],
102
- "default": {}
103
- },
104
- "definitions": {
105
- "type": "object",
106
- "additionalProperties": { "$ref": "#" },
107
- "default": {}
108
- },
109
- "properties": {
110
- "type": "object",
111
- "additionalProperties": { "$ref": "#" },
112
- "default": {}
113
- },
114
- "patternProperties": {
115
- "type": "object",
116
- "additionalProperties": { "$ref": "#" },
117
- "default": {}
118
- },
119
- "dependencies": {
120
- "type": "object",
121
- "additionalProperties": {
122
- "anyOf": [
123
- { "$ref": "#" },
124
- { "$ref": "#/definitions/stringArray" }
125
- ]
126
- }
127
- },
128
- "enum": {
129
- "type": "array",
130
- "minItems": 1,
131
- "uniqueItems": true
132
- },
133
- "type": {
134
- "anyOf": [
135
- { "$ref": "#/definitions/simpleTypes" },
136
- {
137
- "type": "array",
138
- "items": { "$ref": "#/definitions/simpleTypes" },
139
- "minItems": 1,
140
- "uniqueItems": true
141
- }
142
- ]
143
- },
144
- "format": { "type": "string" },
145
- "allOf": { "$ref": "#/definitions/schemaArray" },
146
- "anyOf": { "$ref": "#/definitions/schemaArray" },
147
- "oneOf": { "$ref": "#/definitions/schemaArray" },
148
- "not": { "$ref": "#" }
149
- },
150
- "dependencies": {
151
- "exclusiveMaximum": [ "maximum" ],
152
- "exclusiveMinimum": [ "minimum" ]
153
- },
154
- "default": {}
155
- }
156
-
157
- exports["json-schema-draft-06"] = {
158
- "$schema": "http://json-schema.org/draft-06/schema#",
159
- "$id": "http://json-schema.org/draft-06/schema#",
160
- "title": "Core schema meta-schema",
161
- "definitions": {
162
- "schemaArray": {
163
- "type": "array",
164
- "minItems": 1,
165
- "items": { "$ref": "#" }
166
- },
167
- "nonNegativeInteger": {
168
- "type": "integer",
169
- "minimum": 0
170
- },
171
- "nonNegativeIntegerDefault0": {
172
- "allOf": [
173
- { "$ref": "#/definitions/nonNegativeInteger" },
174
- { "default": 0 }
175
- ]
176
- },
177
- "simpleTypes": {
178
- "enum": [
179
- "array",
180
- "boolean",
181
- "integer",
182
- "null",
183
- "number",
184
- "object",
185
- "string"
186
- ]
187
- },
188
- "stringArray": {
189
- "type": "array",
190
- "items": { "type": "string" },
191
- "uniqueItems": true,
192
- "default": []
193
- }
194
- },
195
- "type": ["object", "boolean"],
196
- "properties": {
197
- "$id": {
198
- "type": "string",
199
- "format": "uri-reference"
200
- },
201
- "$schema": {
202
- "type": "string",
203
- "format": "uri"
204
- },
205
- "$ref": {
206
- "type": "string",
207
- "format": "uri-reference"
208
- },
209
- "title": {
210
- "type": "string"
211
- },
212
- "description": {
213
- "type": "string"
214
- },
215
- "default": {},
216
- "examples": {
217
- "type": "array",
218
- "items": {}
219
- },
220
- "multipleOf": {
221
- "type": "number",
222
- "exclusiveMinimum": 0
223
- },
224
- "maximum": {
225
- "type": "number"
226
- },
227
- "exclusiveMaximum": {
228
- "type": "number"
229
- },
230
- "minimum": {
231
- "type": "number"
232
- },
233
- "exclusiveMinimum": {
234
- "type": "number"
235
- },
236
- "maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
237
- "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
238
- "pattern": {
239
- "type": "string",
240
- "format": "regex"
241
- },
242
- "additionalItems": { "$ref": "#" },
243
- "items": {
244
- "anyOf": [
245
- { "$ref": "#" },
246
- { "$ref": "#/definitions/schemaArray" }
247
- ],
248
- "default": {}
249
- },
250
- "maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
251
- "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
252
- "uniqueItems": {
253
- "type": "boolean",
254
- "default": false
255
- },
256
- "contains": { "$ref": "#" },
257
- "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
258
- "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
259
- "required": { "$ref": "#/definitions/stringArray" },
260
- "additionalProperties": { "$ref": "#" },
261
- "definitions": {
262
- "type": "object",
263
- "additionalProperties": { "$ref": "#" },
264
- "default": {}
265
- },
266
- "properties": {
267
- "type": "object",
268
- "additionalProperties": { "$ref": "#" },
269
- "default": {}
270
- },
271
- "patternProperties": {
272
- "type": "object",
273
- "additionalProperties": { "$ref": "#" },
274
- "default": {}
275
- },
276
- "dependencies": {
277
- "type": "object",
278
- "additionalProperties": {
279
- "anyOf": [
280
- { "$ref": "#" },
281
- { "$ref": "#/definitions/stringArray" }
282
- ]
283
- }
284
- },
285
- "propertyNames": { "$ref": "#" },
286
- "const": {},
287
- "enum": {
288
- "type": "array",
289
- "minItems": 1,
290
- "uniqueItems": true
291
- },
292
- "type": {
293
- "anyOf": [
294
- { "$ref": "#/definitions/simpleTypes" },
295
- {
296
- "type": "array",
297
- "items": { "$ref": "#/definitions/simpleTypes" },
298
- "minItems": 1,
299
- "uniqueItems": true
300
- }
301
- ]
302
- },
303
- "format": { "type": "string" },
304
- "allOf": { "$ref": "#/definitions/schemaArray" },
305
- "anyOf": { "$ref": "#/definitions/schemaArray" },
306
- "oneOf": { "$ref": "#/definitions/schemaArray" },
307
- "not": { "$ref": "#" }
308
- },
309
- "default": {}
310
- }
311
-
312
- exports["json-schema-draft-07"] = {
313
- "$schema": "http://json-schema.org/draft-07/schema#",
314
- "$id": "http://json-schema.org/draft-07/schema#",
315
- "title": "Core schema meta-schema",
316
- "definitions": {
317
- "schemaArray": {
318
- "type": "array",
319
- "minItems": 1,
320
- "items": { "$ref": "#" }
321
- },
322
- "nonNegativeInteger": {
323
- "type": "integer",
324
- "minimum": 0
325
- },
326
- "nonNegativeIntegerDefault0": {
327
- "allOf": [
328
- { "$ref": "#/definitions/nonNegativeInteger" },
329
- { "default": 0 }
330
- ]
331
- },
332
- "simpleTypes": {
333
- "enum": [
334
- "array",
335
- "boolean",
336
- "integer",
337
- "null",
338
- "number",
339
- "object",
340
- "string"
341
- ]
342
- },
343
- "stringArray": {
344
- "type": "array",
345
- "items": { "type": "string" },
346
- "uniqueItems": true,
347
- "default": []
348
- }
349
- },
350
- "type": ["object", "boolean"],
351
- "properties": {
352
- "$id": {
353
- "type": "string",
354
- "format": "uri-reference"
355
- },
356
- "$schema": {
357
- "type": "string",
358
- "format": "uri"
359
- },
360
- "$ref": {
361
- "type": "string",
362
- "format": "uri-reference"
363
- },
364
- "$comment": {
365
- "type": "string"
366
- },
367
- "title": {
368
- "type": "string"
369
- },
370
- "description": {
371
- "type": "string"
372
- },
373
- "default": true,
374
- "readOnly": {
375
- "type": "boolean",
376
- "default": false
377
- },
378
- "examples": {
379
- "type": "array",
380
- "items": true
381
- },
382
- "multipleOf": {
383
- "type": "number",
384
- "exclusiveMinimum": 0
385
- },
386
- "maximum": {
387
- "type": "number"
388
- },
389
- "exclusiveMaximum": {
390
- "type": "number"
391
- },
392
- "minimum": {
393
- "type": "number"
394
- },
395
- "exclusiveMinimum": {
396
- "type": "number"
397
- },
398
- "maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
399
- "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
400
- "pattern": {
401
- "type": "string",
402
- "format": "regex"
403
- },
404
- "additionalItems": { "$ref": "#" },
405
- "items": {
406
- "anyOf": [
407
- { "$ref": "#" },
408
- { "$ref": "#/definitions/schemaArray" }
409
- ],
410
- "default": true
411
- },
412
- "maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
413
- "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
414
- "uniqueItems": {
415
- "type": "boolean",
416
- "default": false
417
- },
418
- "contains": { "$ref": "#" },
419
- "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
420
- "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
421
- "required": { "$ref": "#/definitions/stringArray" },
422
- "additionalProperties": { "$ref": "#" },
423
- "definitions": {
424
- "type": "object",
425
- "additionalProperties": { "$ref": "#" },
426
- "default": {}
427
- },
428
- "properties": {
429
- "type": "object",
430
- "additionalProperties": { "$ref": "#" },
431
- "default": {}
432
- },
433
- "patternProperties": {
434
- "type": "object",
435
- "additionalProperties": { "$ref": "#" },
436
- "propertyNames": { "format": "regex" },
437
- "default": {}
438
- },
439
- "dependencies": {
440
- "type": "object",
441
- "additionalProperties": {
442
- "anyOf": [
443
- { "$ref": "#" },
444
- { "$ref": "#/definitions/stringArray" }
445
- ]
446
- }
447
- },
448
- "propertyNames": { "$ref": "#" },
449
- "const": true,
450
- "enum": {
451
- "type": "array",
452
- "items": true,
453
- "minItems": 1,
454
- "uniqueItems": true
455
- },
456
- "type": {
457
- "anyOf": [
458
- { "$ref": "#/definitions/simpleTypes" },
459
- {
460
- "type": "array",
461
- "items": { "$ref": "#/definitions/simpleTypes" },
462
- "minItems": 1,
463
- "uniqueItems": true
464
- }
465
- ]
466
- },
467
- "format": { "type": "string" },
468
- "contentMediaType": { "type": "string" },
469
- "contentEncoding": { "type": "string" },
470
- "if": {"$ref": "#"},
471
- "then": {"$ref": "#"},
472
- "else": {"$ref": "#"},
473
- "allOf": { "$ref": "#/definitions/schemaArray" },
474
- "anyOf": { "$ref": "#/definitions/schemaArray" },
475
- "oneOf": { "$ref": "#/definitions/schemaArray" },
476
- "not": { "$ref": "#" }
477
- },
478
- "default": true
479
- }
480
-
481
- Object.defineProperty(exports, '__esModule', { value: true });
482
- }));