json-schema-library 5.3.0 → 7.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/.editorconfig +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +106 -0
- package/README.md +811 -199
- package/TASKS.md +3 -81
- package/dist/index.d.ts +29 -71
- package/dist/jsonSchemaLibrary.js +1 -1
- package/dist/lib/SchemaService.d.ts +6 -8
- package/dist/lib/{addSchema.d.ts → addRemoteSchema.d.ts} +2 -1
- package/dist/lib/addValidator.d.ts +3 -2
- package/dist/lib/compile/getRef.d.ts +2 -1
- package/dist/lib/compile/index.d.ts +15 -1
- package/dist/lib/compile/types.d.ts +5 -0
- package/dist/lib/config/strings.d.ts +1 -39
- package/dist/lib/draft/index.d.ts +132 -0
- package/dist/lib/draft04/index.d.ts +7 -0
- package/dist/lib/draft06/compile/index.d.ts +16 -0
- package/dist/lib/draft06/index.d.ts +7 -0
- package/dist/lib/draft06/validation/keyword.d.ts +3 -0
- package/dist/lib/draft06/validation/type.d.ts +10 -0
- package/dist/lib/draft06/validation/typeKeywordMapping.d.ts +13 -0
- package/dist/lib/draft07/index.d.ts +7 -0
- package/dist/lib/each.d.ts +3 -2
- package/dist/lib/eachSchema.d.ts +2 -4
- package/dist/lib/getChildSchemaSelection.d.ts +7 -5
- package/dist/lib/getSchema.d.ts +2 -2
- package/dist/lib/getTemplate.d.ts +1 -1
- package/dist/lib/getTypeOf.d.ts +2 -1
- package/dist/lib/isValid.d.ts +1 -1
- package/dist/lib/jsoneditor/index.d.ts +7 -0
- package/dist/lib/resolveAllOf.d.ts +1 -1
- package/dist/lib/resolveAnyOf.d.ts +1 -1
- package/dist/lib/resolveOneOf.fuzzy.d.ts +1 -1
- package/dist/lib/resolveOneOf.strict.d.ts +2 -2
- package/dist/lib/{resolveRef.withOverwrite.d.ts → resolveRef.merge.d.ts} +0 -0
- package/dist/lib/schema/getTypeDefs.d.ts +6 -4
- package/dist/lib/schema/getTypeId.d.ts +1 -1
- package/dist/lib/schema/types.d.ts +7 -57
- package/dist/lib/step.d.ts +5 -5
- package/dist/lib/types.d.ts +11 -3
- package/dist/lib/utils/createCustomError.d.ts +8 -11
- package/dist/lib/utils/filter.d.ts +4 -4
- package/dist/lib/utils/flattenArray.d.ts +1 -1
- package/dist/lib/utils/merge.d.ts +3 -0
- package/dist/lib/utils/punycode.ucs2decode.d.ts +1 -1
- package/dist/lib/validate.d.ts +2 -2
- package/dist/lib/validateAsync.d.ts +1 -1
- package/dist/lib/validation/errors.d.ts +1 -3
- package/dist/lib/validation/format.d.ts +4 -11
- package/dist/lib/validation/keyword.d.ts +2 -27
- package/dist/lib/validation/type.d.ts +3 -10
- package/dist/lib/validation/typeKeywordMapping.d.ts +4 -4
- package/dist/module/index.js +23 -32
- package/dist/module/lib/SchemaService.js +7 -4
- package/dist/module/lib/{addSchema.js → addRemoteSchema.js} +2 -4
- package/dist/module/lib/addValidator.js +3 -4
- package/dist/module/lib/compile/getRef.js +1 -1
- package/dist/module/lib/compile/index.js +43 -18
- package/dist/module/lib/compile/types.js +1 -0
- package/dist/module/lib/config/strings.js +15 -2
- package/dist/module/lib/createSchemaOf.js +1 -1
- package/dist/module/lib/draft/index.js +133 -0
- package/dist/module/lib/draft04/index.js +90 -0
- package/dist/module/lib/draft06/compile/index.js +77 -0
- package/dist/module/lib/draft06/index.js +96 -0
- package/dist/module/lib/draft06/validation/keyword.js +168 -0
- package/dist/module/lib/draft06/validation/type.js +31 -0
- package/dist/module/lib/draft06/validation/typeKeywordMapping.js +15 -0
- package/dist/module/lib/draft07/index.js +96 -0
- package/dist/module/lib/each.js +2 -2
- package/dist/module/lib/eachSchema.js +28 -19
- package/dist/module/lib/getChildSchemaSelection.js +7 -6
- package/dist/module/lib/getSchema.js +4 -2
- package/dist/module/lib/getTemplate.js +42 -15
- package/dist/module/lib/jsoneditor/index.js +16 -0
- package/dist/module/lib/resolveAllOf.js +3 -4
- package/dist/module/lib/resolveOneOf.fuzzy.js +13 -3
- package/dist/module/lib/resolveOneOf.strict.js +49 -2
- package/dist/module/lib/{resolveRef.withOverwrite.js → resolveRef.merge.js} +0 -0
- package/dist/module/lib/resolveRef.strict.js +8 -0
- package/dist/module/lib/schema/getTypeDefs.js +14 -3
- package/dist/module/lib/schema/getTypeId.js +10 -6
- package/dist/module/lib/schema/types.js +33 -9
- package/dist/module/lib/step.js +67 -13
- package/dist/module/lib/types.js +7 -1
- package/dist/module/lib/utils/createCustomError.js +4 -4
- package/dist/module/lib/utils/filter.js +3 -5
- package/dist/module/lib/utils/flattenArray.js +4 -3
- package/dist/module/lib/utils/merge.js +4 -0
- package/dist/module/lib/utils/punycode.ucs2decode.js +4 -3
- package/dist/module/lib/validate.js +34 -8
- package/dist/module/lib/validateAsync.js +7 -7
- package/dist/module/lib/validation/errors.js +16 -3
- package/dist/module/lib/validation/format.js +115 -8
- package/dist/module/lib/validation/keyword.js +79 -32
- package/dist/module/lib/validation/type.js +2 -1
- package/index.ts +46 -32
- package/lib/SchemaService.ts +18 -11
- package/lib/{addSchema.ts → addRemoteSchema.ts} +3 -5
- package/lib/addValidator.ts +15 -12
- package/lib/compile/getRef.ts +3 -4
- package/lib/compile/index.ts +65 -19
- package/lib/compile/types.ts +6 -0
- package/lib/config/strings.ts +17 -3
- package/lib/createSchemaOf.ts +1 -3
- package/lib/draft/index.ts +201 -0
- package/lib/draft04/index.ts +95 -0
- package/lib/draft06/compile/index.ts +104 -0
- package/lib/draft06/index.ts +101 -0
- package/lib/draft06/validation/keyword.ts +199 -0
- package/lib/draft06/validation/type.ts +47 -0
- package/lib/draft06/validation/typeKeywordMapping.ts +15 -0
- package/lib/draft07/index.ts +101 -0
- package/lib/each.ts +11 -4
- package/lib/eachSchema.ts +45 -32
- package/lib/getChildSchemaSelection.ts +14 -7
- package/lib/getSchema.ts +18 -9
- package/lib/getTemplate.ts +155 -42
- package/lib/getTypeOf.ts +2 -1
- package/lib/isValid.ts +7 -3
- package/lib/jsoneditor/index.ts +20 -0
- package/lib/resolveAllOf.ts +10 -6
- package/lib/resolveAnyOf.ts +7 -3
- package/lib/resolveOneOf.fuzzy.ts +26 -9
- package/lib/resolveOneOf.strict.ts +63 -5
- package/lib/{resolveRef.withOverwrite.ts → resolveRef.merge.ts} +0 -0
- package/lib/resolveRef.strict.ts +9 -0
- package/lib/schema/getTypeDefs.ts +19 -7
- package/lib/schema/getTypeId.ts +11 -8
- package/lib/schema/types.ts +41 -9
- package/lib/step.ts +109 -25
- package/lib/types.ts +23 -5
- package/lib/utils/createCustomError.ts +8 -13
- package/lib/utils/filter.ts +7 -9
- package/lib/utils/flattenArray.ts +5 -4
- package/lib/utils/merge.ts +5 -0
- package/lib/utils/punycode.ucs2decode.ts +6 -5
- package/lib/validate.ts +47 -16
- package/lib/validateAsync.ts +15 -14
- package/lib/validation/errors.ts +17 -6
- package/lib/validation/format.ts +147 -13
- package/lib/validation/keyword.ts +172 -103
- package/lib/validation/type.ts +5 -1
- package/package.json +75 -63
- package/{dist/module/remotes/draft04.json → remotes/draft06.json} +47 -42
- package/remotes/draft07.json +172 -0
- package/remotes/draft2019-09.json +86 -0
- package/tsconfig.json +3 -10
- package/dist/lib/cores/CoreInterface.d.ts +0 -23
- package/dist/lib/cores/Draft04.d.ts +0 -13
- package/dist/lib/cores/JsonEditor.d.ts +0 -13
- package/dist/module/lib/cores/CoreInterface.js +0 -51
- package/dist/module/lib/cores/Draft04.js +0 -52
- package/dist/module/lib/cores/JsonEditor.js +0 -51
- package/dist/module/remotes/index.js +0 -10
- package/dist/remotes/index.d.ts +0 -5
- package/lib/cores/CoreInterface.ts +0 -76
- package/lib/cores/Draft04.ts +0 -66
- package/lib/cores/JsonEditor.ts +0 -64
- package/remotes/index.ts +0 -11
package/.editorconfig
CHANGED
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lib/config/strings.ts
|
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
## Changelog
|
|
2
|
+
|
|
3
|
+
### 7.0.0
|
|
4
|
+
|
|
5
|
+
- changed core interface to draft for simpler configuration using a configuration map
|
|
6
|
+
|
|
7
|
+
**Breaking Changes**
|
|
8
|
+
|
|
9
|
+
- replaced `Core` interface by new `Draft` interface
|
|
10
|
+
- changed export of `Interface` to `Draft`
|
|
11
|
+
- changed export of `Interface` to `Draft`
|
|
12
|
+
- renamed `addSchema` to `addRemoteSchema`
|
|
13
|
+
- changed api of `compileSchema` to have an additional schema-parameter for rootSchema reference
|
|
14
|
+
- changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
|
|
15
|
+
- `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
|
|
16
|
+
- removed direct export of following functions: `addValidator`, `compileSchema`, `createSchemaOf`, `each`, `eachSchema`, `getChildSchemaSelection`, `getSchema`, `getTemplate`, `isValid`, `step`, `validate`. They are still accessible under the draftConfigs of each draft-version
|
|
17
|
+
- changed draft version of `JsonEditor` to draft07
|
|
18
|
+
|
|
19
|
+
**Milestone**
|
|
20
|
+
|
|
21
|
+
- [✓] configurable and consistent draft api
|
|
22
|
+
- [✓] expose all function under their draft-version
|
|
23
|
+
- [✓] remove global states in remotes
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 6.1.0
|
|
27
|
+
|
|
28
|
+
- [✓] Feature -- add support for dependencies in _getSchema_ and _getTemplate_
|
|
29
|
+
- [✓] Feature -- added isJSONError type guard
|
|
30
|
+
- fixe and improve types
|
|
31
|
+
|
|
32
|
+
### version 4.0
|
|
33
|
+
|
|
34
|
+
- [✓] Fix -- latest benchmark tests
|
|
35
|
+
- [✓] Fix -- iterate schema (using typeDefs)
|
|
36
|
+
- [✓] Fix -- scopes per schema-instance
|
|
37
|
+
- [✓] Fix -- insane $ref resolution 'node' can be in 'root/node' or 'root/folder/node'
|
|
38
|
+
- [✓] Refactor -- remove duplication from resolveRef.strict and resolveRef.withOverwrite
|
|
39
|
+
- [✓] Change -- improve function apis (param order, rootSchema per default)
|
|
40
|
+
- [✓] Fix -- `getTemplate` to resolve $ref to infinity
|
|
41
|
+
|
|
42
|
+
**Breaking Changes**
|
|
43
|
+
|
|
44
|
+
- `iterateSchema` renamed to `eachSchema`
|
|
45
|
+
- `validate` and `isValid` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
|
|
46
|
+
- `validateAsync` changed signature from (schema, data, [pointer], [onError]) to (data, [{ schema, pointer, onError }])
|
|
47
|
+
- `getTemplate` changed signature from (schema, data) to (data, [schema])
|
|
48
|
+
- `getSchema` changed signature from (schema, data, [pointer]) to (pointer, [data], [schema])
|
|
49
|
+
- `each` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
|
|
50
|
+
- `resolveOneOf` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
|
|
51
|
+
- `precompileSchema` renamed to `compileSchema`
|
|
52
|
+
|
|
53
|
+
**Milestone** consistent feature support
|
|
54
|
+
|
|
55
|
+
- [✓] no side-effects on added remote-schemas
|
|
56
|
+
- [✓] rootSchema should always be compiled
|
|
57
|
+
- [✓] Add missing support for allOf and anyOf type definitions in 'step' and 'getTemplate'
|
|
58
|
+
- [✓] Complete schema support in iterateSchema
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## 2017
|
|
62
|
+
|
|
63
|
+
- [~] Features -- Improve validation maps to add & hook (!) custom entries (WIP, Add tests)
|
|
64
|
+
- [✓] Fix -- Return all errors in oneOf-validation
|
|
65
|
+
- [✓] Feature -- Error progress notification for async validation
|
|
66
|
+
- [✓] Refactor -- Keyword validators should only be called for defined keyword
|
|
67
|
+
- [✓] Feature -- getSchema of patternProperties
|
|
68
|
+
|
|
69
|
+
**Milestone** add remaining draft04 features
|
|
70
|
+
- [✓] remote references
|
|
71
|
+
- [✓] default format validations
|
|
72
|
+
- [✓] definitions
|
|
73
|
+
- [✓] dependencies
|
|
74
|
+
- [✓] Features -- allOf
|
|
75
|
+
- [✓] Features -- anyOf
|
|
76
|
+
- [✓] Features -- type-array
|
|
77
|
+
- [✓] Features -- patternProperties
|
|
78
|
+
- [✓] Features -- uniqueItems
|
|
79
|
+
- [✓] Features -- oneOf: fail for multiple matching oneof-schemas
|
|
80
|
+
- [✓] Features -- oneOf: for non-arrays
|
|
81
|
+
- [✓] Features -- required (array of properties). Currently every property is required by default
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## 16/12
|
|
85
|
+
|
|
86
|
+
- [✓] Testing (validate real json files)
|
|
87
|
+
- [✓] Test + document core differences
|
|
88
|
+
- [✓] Add async validation
|
|
89
|
+
|
|
90
|
+
**Milestone** customizable default and form (json-editor) validation
|
|
91
|
+
- [✓] Sanitize Errors
|
|
92
|
+
- [✓] Features -- Add core: Form, fix core: Draft04 - by using separate functions
|
|
93
|
+
- [✓] Add getTemplate to core (resolveOneOf)
|
|
94
|
+
- [✓] Breaking -- Add sort of 'core' to customize validation, stepper, errors etc and reduce requried arguments
|
|
95
|
+
|
|
96
|
+
**Milestone** custom validator (form-validation, oneOfProperty)
|
|
97
|
+
- [✓] Features -- additionalProperties: Boolean | Schema
|
|
98
|
+
- [✓] Features -- additionalItems: Boolean | Schema
|
|
99
|
+
- [✓] Features -- Add support for type "integer"
|
|
100
|
+
- [✓] Features -- oneOf -> oneOfProperty ( + Documentation)
|
|
101
|
+
- [✓] Breaking -- change isValid to return boolean
|
|
102
|
+
- [✓] Breaking -- use `step` in isValid -- bad: circular dependencies with step -> guessOneOfSchema -> isValid --X-> step
|
|
103
|
+
- [✓] Features -- items: [] schema (order/defined indices)
|
|
104
|
+
- [✓] Features -- not
|
|
105
|
+
- [✓] Features -- return custom errors in data validation
|
|
106
|
+
- [✓] Basics
|