json-schema-library 11.0.2 → 11.0.4

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/CHANGELOG.md CHANGED
@@ -1,123 +1,243 @@
1
1
  ## Changelog
2
2
 
3
- - reference for error-format: https://json-schema.org/blog/posts/fixing-json-schema-output
3
+ ### v11.0.3
4
+
5
+ - fixed type of main input-schema to support boolean
6
+
7
+ ### v11.0.2
8
+
9
+ - fixed `getNode` to always return a reduced JSON schema
10
+ - fixed issues using reduce with `oneOfProperty`
11
+
12
+ ### v11.0.1
13
+
14
+ - improved error reporting when using oneOfProperty-declarator
15
+
16
+ ### v11.0.0
17
+
18
+ - introduced annotations
19
+ - added node.createAnnotation helper
20
+ - changed typing to strict
21
+ - added annotations-list to `validate()` result
22
+ - added keyword support for `deprecated: true` which returns a `deprecated-warning` annotation
23
+
24
+ **breaking changes**:
25
+
26
+ - Return type of validators is now `ValidationReturnType` instead of `ValidationResult`
27
+ - type `AnnotationData` replaces `ErroData`
28
+
29
+ ### v10.5.0
30
+
31
+ - added support for ref resolution in getSchemaType
32
+
33
+ ### v10.4.0
34
+
35
+ - introduced esm module export
36
+ - fixed typo in argument ~~disableRecusionLimit~~ disableRecursionLimit
37
+ - added settings to exports for global changes of settings
38
+
39
+ ### v10.3.0
40
+
41
+ - introduce setting `REGEX_FLAGS` and schema-property `regexFlags` to customize regex flags to use evaluating regex
42
+ - fixed an issue resolving non-URI compatible $ref-targets containing `#/definitions`
43
+
44
+ ### v10.2.0
45
+
46
+ - introduce getData setting `useTypeDefaults`
47
+ - introduce support to merge meta-properties using $ref-resolution
48
+
49
+ ### v10.1.0
50
+
51
+ - replaced `node.additionalItems` by `node.items` for drafts below 2020-12
52
+ - fixed `additionalItems` behaviour to be ignored when `schema.items` is not an array
53
+
54
+ ### v10.0.0
55
+
56
+ > This update involves some significant changes in how you work with the library, so please carefully review the migration guide and adjust your implementation accordingly.
57
+
58
+ In version v10.0.0, we've made significant changes to the library’s API, particularly in how we handle drafts and schemas. These changes are required to support features like `dynamicAnchor`, `unevaluatedItems`, and `oneOfIndex` and to integrate with the headless-json-editor. The previous approach of directly working with JSON schema objects lacked the flexibility needed for more advanced features and extensibility.
59
+
60
+ The new implementation revolves around compiling schemas into a **SchemaNode** tree. This change offers a more fitting, simpler, and extensible approach to working with JSON schemas.
61
+
62
+ #### Key Changes:
63
+
64
+ - **Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
65
+ - **SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
66
+
67
+ #### Breaking Changes:
68
+
69
+ **`compileSchema`** is now a standalone function and replaces the `Draft` class. All return values for JSON Schema are now `SchemaNode` objects that contain a `schema` property.
70
+
71
+ ```ts
72
+ // PREVIOUSLY
73
+ const draft = new Draft(schema);
74
+
75
+ // NOW
76
+ const node = compileSchema(schema);
77
+ ```
78
+
79
+ **Changed Methods**:
80
+
81
+ - `draft.createSchemaOf(schema)` → `node.createSchema(schema)`
82
+ - `draft.each(data, callback)` → `const nodes = node.toDataNodes(data)`
83
+ - `draft.eachSchema(callback)` → `const nodes = node.toSchemaNodes()`
84
+ - `draft.getChildSchemaSelection(property)` → `node.getChildSelection(property)`
85
+ - `draft.getNode(options)` → `node.getNode(pointer, data, options)`
86
+ - `draft.getTemplate(inputData)` → `node.getData(inputData)`
87
+ - `draft.isValid(data)` → `node.validate(data).valid`
88
+ - `draft.step(property, data)` → `node.getNodeChild(property, data)`
89
+
90
+ **Renamed Properties**: `templateDefaultOptions` → `getDataDefaultOptions`
91
+
92
+ **Draft Customization**: Customizing drafts has changed completely. The previous methods of extending drafts are no longer valid, and draft handling is now centered around `SchemaNode`.
93
+
94
+ **Removed Error Property `name`**: Error property `name` has been removed from `JsonError` in favor of `code`.
95
+
96
+ **Removed Configuration Option**: The `templateDefaultOptions` property has been removed from the global settings object. You should now configure it using the `compileSchema` options:
97
+
98
+ ```ts
99
+ compileSchema(schema, {
100
+ getDataDefaultOptions: {
101
+ addOptionalProps: false,
102
+ removeInvalidData: false,
103
+ extendDefaults: true
104
+ }
105
+ });
106
+ ```
107
+
108
+ **Changed remote $id support** in `addRemoteSchema`. An `$id` has to be a valid url (previously any value was accepted)
4
109
 
5
110
  ### v9.0.0
6
111
 
7
- - [Breaking] error data to always contain `schema` and `value`
8
- - [Breaking] getSchema arguments changed to options-object
9
- - [Add] withSchemaWarning option for getSchema to always return an error fpr undefined schema
112
+ **breaking changes**:
113
+
114
+ - _getSchema_ signature changed in favour of an options object. Instead of `draft.getNode(pointer, data)` arguments have to be passed as an object `draft.getNode({ pointer, data })`. This removes setting unwanted optional arguments and keeps the api more stable in the future (e.g. `withSchemaWarning` option)
115
+ - _JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
116
+
117
+ **updates**
118
+
119
+ - _getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
10
120
 
11
121
  ### v8.0.0
12
122
 
13
- - [Breaking] renamed `JSON` types and variables to `Json`
14
- - [Breaking] remove `oneOfSchema` helper property in favor of `getOneOfOrigin()` non-enumerable function
15
- - [Breaking] `getTemplate` will add only required properties per default. Use `addOptionalProps:true` to change this behaviour
16
- - [Breaking] change `unique-items-error` to point to error for duplicated item.
17
- - [add] introduce `mergeSchema`, `reduceSchema` and `resolveDynamicSchema`
18
- - [refactor] move dynamic resolvers `anyOf`, `allOf`, `oneOf`, `dependencies` and `if` to features modules
123
+ With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
124
+
125
+ - Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
126
+ - `getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
127
+ - Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
128
+ - Changed `unique-items-error` to point to error for duplicated item and changed data-properties
129
+ - Removed `SchemaService` as it was no longer used nor tested
130
+
131
+ <details><summary>Exposed new helper functions</summary>
132
+
133
+ - `mergeSchema` - Merges to two json schema
134
+ - `reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
135
+ - `isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
136
+ - `resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
137
+
138
+ </details>
19
139
 
20
140
  ### 7.0.0
21
141
 
22
- - changed core interface to draft for simpler configuration using a configuration map
142
+ - changed core interface to draft for simpler configuration using a configuration map
23
143
 
24
144
  **Breaking Changes**
25
145
 
26
- - replaced `Core` interface by new `Draft` interface
27
- - changed export of `Interface` to `Draft`
28
- - changed export of `Interface` to `Draft`
29
- - renamed `addSchema` to `addRemoteSchema`
30
- - changed api of `compileSchema` to have an additional schema-parameter for rootSchema reference
31
- - changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
32
- - `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
33
- - 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
34
- - changed draft version of `JsonEditor` to draft07
146
+ - replaced `Core` interface by new `Draft` interface
147
+ - changed export of `Interface` to `Draft`
148
+ - changed export of `Interface` to `Draft`
149
+ - renamed `addSchema` to `addRemoteSchema`
150
+ - changed api of `compileSchema` to have an additional schema-parameter for rootSchema reference
151
+ - changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
152
+ - `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
153
+ - 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
154
+ - changed draft version of `JsonEditor` to draft07
35
155
 
36
156
  **Milestone**
37
157
 
38
- - [✓] configurable and consistent draft api
39
- - [✓] expose all function under their draft-version
40
- - [✓] remove global states in remotes
158
+ - [✓] configurable and consistent draft api
159
+ - [✓] expose all function under their draft-version
160
+ - [✓] remove global states in remotes
41
161
 
42
162
  ### 6.1.0
43
163
 
44
- - [✓] Feature -- add support for dependencies in _getSchema_ and _getTemplate_
45
- - [✓] Feature -- added isJSONError type guard
46
- - fixe and improve types
164
+ - [✓] Feature -- add support for dependencies in _getSchema_ and _getTemplate_
165
+ - [✓] Feature -- added isJSONError type guard
166
+ - fixe and improve types
47
167
 
48
168
  ### version 4.0
49
169
 
50
- - [✓] Fix -- latest benchmark tests
51
- - [✓] Fix -- iterate schema (using typeDefs)
52
- - [✓] Fix -- scopes per schema-instance
53
- - [✓] Fix -- insane $ref resolution 'node' can be in 'root/node' or 'root/folder/node'
54
- - [✓] Refactor -- remove duplication from resolveRef.strict and resolveRef.withOverwrite
55
- - [✓] Change -- improve function apis (param order, rootSchema per default)
56
- - [✓] Fix -- `getTemplate` to resolve $ref to infinity
170
+ - [✓] Fix -- latest benchmark tests
171
+ - [✓] Fix -- iterate schema (using typeDefs)
172
+ - [✓] Fix -- scopes per schema-instance
173
+ - [✓] Fix -- insane $ref resolution 'node' can be in 'root/node' or 'root/folder/node'
174
+ - [✓] Refactor -- remove duplication from resolveRef.strict and resolveRef.withOverwrite
175
+ - [✓] Change -- improve function apis (param order, rootSchema per default)
176
+ - [✓] Fix -- `getTemplate` to resolve $ref to infinity
57
177
 
58
178
  **Breaking Changes**
59
179
 
60
- - `iterateSchema` renamed to `eachSchema`
61
- - `validate` and `isValid` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
62
- - `validateAsync` changed signature from (schema, data, [pointer], [onError]) to (data, [{ schema, pointer, onError }])
63
- - `getTemplate` changed signature from (schema, data) to (data, [schema])
64
- - `getSchema` changed signature from (schema, data, [pointer]) to (pointer, [data], [schema])
65
- - `each` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
66
- - `resolveOneOf` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
67
- - `precompileSchema` renamed to `compileSchema`
180
+ - `iterateSchema` renamed to `eachSchema`
181
+ - `validate` and `isValid` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
182
+ - `validateAsync` changed signature from (schema, data, [pointer], [onError]) to (data, [{ schema, pointer, onError }])
183
+ - `getTemplate` changed signature from (schema, data) to (data, [schema])
184
+ - `getSchema` changed signature from (schema, data, [pointer]) to (pointer, [data], [schema])
185
+ - `each` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
186
+ - `resolveOneOf` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
187
+ - `precompileSchema` renamed to `compileSchema`
68
188
 
69
189
  **Milestone** consistent feature support
70
190
 
71
- - [✓] no side-effects on added remote-schemas
72
- - [✓] rootSchema should always be compiled
73
- - [✓] Add missing support for allOf and anyOf type definitions in 'step' and 'getTemplate'
74
- - [✓] Complete schema support in iterateSchema
191
+ - [✓] no side-effects on added remote-schemas
192
+ - [✓] rootSchema should always be compiled
193
+ - [✓] Add missing support for allOf and anyOf type definitions in 'step' and 'getTemplate'
194
+ - [✓] Complete schema support in iterateSchema
75
195
 
76
196
  ## 2017
77
197
 
78
- - [~] Features -- Improve validation maps to add & hook (!) custom entries (WIP, Add tests)
79
- - [✓] Fix -- Return all errors in oneOf-validation
80
- - [✓] Feature -- Error progress notification for async validation
81
- - [✓] Refactor -- Keyword validators should only be called for defined keyword
82
- - [✓] Feature -- getSchema of patternProperties
198
+ - [~] Features -- Improve validation maps to add & hook (!) custom entries (WIP, Add tests)
199
+ - [✓] Fix -- Return all errors in oneOf-validation
200
+ - [✓] Feature -- Error progress notification for async validation
201
+ - [✓] Refactor -- Keyword validators should only be called for defined keyword
202
+ - [✓] Feature -- getSchema of patternProperties
83
203
 
84
204
  **Milestone** add remaining draft04 features
85
205
 
86
- - [✓] remote references
87
- - [✓] default format validations
88
- - [✓] definitions
89
- - [✓] dependencies
90
- - [✓] Features -- allOf
91
- - [✓] Features -- anyOf
92
- - [✓] Features -- type-array
93
- - [✓] Features -- patternProperties
94
- - [✓] Features -- uniqueItems
95
- - [✓] Features -- oneOf: fail for multiple matching oneof-schemas
96
- - [✓] Features -- oneOf: for non-arrays
97
- - [✓] Features -- required (array of properties). Currently every property is required by default
206
+ - [✓] remote references
207
+ - [✓] default format validations
208
+ - [✓] definitions
209
+ - [✓] dependencies
210
+ - [✓] Features -- allOf
211
+ - [✓] Features -- anyOf
212
+ - [✓] Features -- type-array
213
+ - [✓] Features -- patternProperties
214
+ - [✓] Features -- uniqueItems
215
+ - [✓] Features -- oneOf: fail for multiple matching oneof-schemas
216
+ - [✓] Features -- oneOf: for non-arrays
217
+ - [✓] Features -- required (array of properties). Currently every property is required by default
98
218
 
99
219
  ## 16/12
100
220
 
101
- - [✓] Testing (validate real json files)
102
- - [✓] Test + document core differences
103
- - [✓] Add async validation
221
+ - [✓] Testing (validate real json files)
222
+ - [✓] Test + document core differences
223
+ - [✓] Add async validation
104
224
 
105
225
  **Milestone** customizable default and form (json-editor) validation
106
226
 
107
- - [✓] Sanitize Errors
108
- - [✓] Features -- Add core: Form, fix core: Draft04 - by using separate functions
109
- - [✓] Add getTemplate to core (resolveOneOf)
110
- - [✓] Breaking -- Add sort of 'core' to customize validation, stepper, errors etc and reduce requried arguments
227
+ - [✓] Sanitize Errors
228
+ - [✓] Features -- Add core: Form, fix core: Draft04 - by using separate functions
229
+ - [✓] Add getTemplate to core (resolveOneOf)
230
+ - [✓] Breaking -- Add sort of 'core' to customize validation, stepper, errors etc and reduce requried arguments
111
231
 
112
232
  **Milestone** custom validator (form-validation, oneOfProperty)
113
233
 
114
- - [✓] Features -- additionalProperties: Boolean | Schema
115
- - [✓] Features -- additionalItems: Boolean | Schema
116
- - [✓] Features -- Add support for type "integer"
117
- - [✓] Features -- oneOf -> oneOfProperty ( + Documentation)
118
- - [✓] Breaking -- change isValid to return boolean
119
- - [✓] Breaking -- use `step` in isValid -- bad: circular dependencies with step -> guessOneOfSchema -> isValid --X-> step
120
- - [✓] Features -- items: [] schema (order/defined indices)
121
- - [✓] Features -- not
122
- - [✓] Features -- return custom errors in data validation
123
- - [✓] Basics
234
+ - [✓] Features -- additionalProperties: Boolean | Schema
235
+ - [✓] Features -- additionalItems: Boolean | Schema
236
+ - [✓] Features -- Add support for type "integer"
237
+ - [✓] Features -- oneOf -> oneOfProperty ( + Documentation)
238
+ - [✓] Breaking -- change isValid to return boolean
239
+ - [✓] Breaking -- use `step` in isValid -- bad: circular dependencies with step -> guessOneOfSchema -> isValid --X-> step
240
+ - [✓] Features -- items: [] schema (order/defined indices)
241
+ - [✓] Features -- not
242
+ - [✓] Features -- return custom errors in data validation
243
+ - [✓] Basics
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  ---
12
12
 
13
13
  <div align="center">
14
- <a href="#overview"><b>Overview</b></a> · <a href="#schemanode-methods"><b>Methods</b></a> · <a href="#draft-customization"><b>Customization</b></a> · <a href="#keyword-extensions"><b>Extensions</b></a> · <a href="#breaking-changes">Breaking Changes</a>
14
+ <a href="#overview"><b>Overview</b></a> · <a href="#schemanode-methods"><b>Methods</b></a> · <a href="#draft-customization"><b>Customization</b></a> · <a href="#keyword-extensions"><b>Extensions</b></a> · <a href="./CHANGELOG.md">Changelog</a>
15
15
  </div>
16
16
 
17
17
  ---
@@ -658,6 +658,9 @@ const { node, error } = schemaNode.getNode("/name", { name: 123 }, { createSchem
658
658
  console.log(node?.schema, error); // { type: "number" }, undefined
659
659
  ```
660
660
 
661
+ > [!NOTE]
662
+ > `getChild` will return the reduced node (using `reduceNode` internally) for the given input-data. This means, the resulting json-schema is a merge of all defined JSON schema. For more control use `getChildNode`, which will not further compile JSON schema
663
+
661
664
  <details><summary>Example</summary>
662
665
 
663
666
  ```ts
@@ -747,7 +750,7 @@ if (error) {
747
750
 
748
751
  ### getNodeChild
749
752
 
750
- `getNodeChild` retrieves the SchemaNode of a child property or index. Using `get` it is possible to incrementally go through the data, retrieving the schema for each next item.
753
+ `getNodeChild` retrieves the SchemaNode of a child property or index. Using `getNodeChild` it is possible to incrementally go through the data, retrieving the schema for each next item.
751
754
 
752
755
  ```ts
753
756
  const mySchema = { type: "object", properties: { title: { type: "string" } } };
@@ -1461,133 +1464,3 @@ import settings from "json-schema-library";
1461
1464
 
1462
1465
  settings.REGEX_FLAGS = "v";
1463
1466
  ```
1464
-
1465
- ## Breaking Changes
1466
-
1467
- ### v11.0.1
1468
-
1469
- - improved error reporting when using oneOfProperty-declarator
1470
-
1471
- ### v11.0.0
1472
-
1473
- - introduced annotations
1474
- - added node.createAnnotation helper
1475
- - changed typing to strict
1476
- - added annotations-list to `validate()` result
1477
- - added keyword support for `deprecated: true` which returns a `deprecated-warning` annotation
1478
-
1479
- **breaking changes**:
1480
-
1481
- - Return type of validators is now `ValidationReturnType` instead of `ValidationResult`
1482
- - type `AnnotationData` replaces `ErroData`
1483
-
1484
- ### v10.5.0
1485
-
1486
- - added support for ref resolution in getSchemaType
1487
-
1488
- ### v10.4.0
1489
-
1490
- - introduced esm module export
1491
- - fixed typo in argument ~~disableRecusionLimit~~ disableRecursionLimit
1492
- - added settings to exports for global changes of settings
1493
-
1494
- ### v10.3.0
1495
-
1496
- - introduce setting `REGEX_FLAGS` and schema-property `regexFlags` to customize regex flags to use evaluating regex
1497
- - fixed an issue resolving non-URI compatible $ref-targets containing `#/definitions`
1498
-
1499
- ### v10.2.0
1500
-
1501
- - introduce getData setting `useTypeDefaults`
1502
- - introduce support to merge meta-properties using $ref-resolution
1503
-
1504
- ### v10.1.0
1505
-
1506
- - replaced `node.additionalItems` by `node.items` for drafts below 2020-12
1507
- - fixed `additionalItems` behaviour to be ignored when `schema.items` is not an array
1508
-
1509
- ### v10.0.0
1510
-
1511
- > This update involves some significant changes in how you work with the library, so please carefully review the migration guide and adjust your implementation accordingly.
1512
-
1513
- In version v10.0.0, we've made significant changes to the library’s API, particularly in how we handle drafts and schemas. These changes are required to support features like `dynamicAnchor`, `unevaluatedItems`, and `oneOfIndex` and to integrate with the headless-json-editor. The previous approach of directly working with JSON schema objects lacked the flexibility needed for more advanced features and extensibility.
1514
-
1515
- The new implementation revolves around compiling schemas into a **SchemaNode** tree. This change offers a more fitting, simpler, and extensible approach to working with JSON schemas.
1516
-
1517
- #### Key Changes:
1518
-
1519
- - **Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
1520
- - **SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
1521
-
1522
- #### Breaking Changes:
1523
-
1524
- **`compileSchema`** is now a standalone function and replaces the `Draft` class. All return values for JSON Schema are now `SchemaNode` objects that contain a `schema` property.
1525
-
1526
- ```ts
1527
- // PREVIOUSLY
1528
- const draft = new Draft(schema);
1529
-
1530
- // NOW
1531
- const node = compileSchema(schema);
1532
- ```
1533
-
1534
- **Changed Methods**:
1535
-
1536
- - `draft.createSchemaOf(schema)` → `node.createSchema(schema)`
1537
- - `draft.each(data, callback)` → `const nodes = node.toDataNodes(data)`
1538
- - `draft.eachSchema(callback)` → `const nodes = node.toSchemaNodes()`
1539
- - `draft.getChildSchemaSelection(property)` → `node.getChildSelection(property)`
1540
- - `draft.getNode(options)` → `node.getNode(pointer, data, options)`
1541
- - `draft.getTemplate(inputData)` → `node.getData(inputData)`
1542
- - `draft.isValid(data)` → `node.validate(data).valid`
1543
- - `draft.step(property, data)` → `node.getNodeChild(property, data)`
1544
-
1545
- **Renamed Properties**: `templateDefaultOptions` → `getDataDefaultOptions`
1546
-
1547
- **Draft Customization**: Customizing drafts has changed completely. The previous methods of extending drafts are no longer valid, and draft handling is now centered around `SchemaNode`.
1548
-
1549
- **Removed Error Property `name`**: Error property `name` has been removed from `JsonError` in favor of `code`.
1550
-
1551
- **Removed Configuration Option**: The `templateDefaultOptions` property has been removed from the global settings object. You should now configure it using the `compileSchema` options:
1552
-
1553
- ```ts
1554
- compileSchema(schema, {
1555
- getDataDefaultOptions: {
1556
- addOptionalProps: false,
1557
- removeInvalidData: false,
1558
- extendDefaults: true
1559
- }
1560
- });
1561
- ```
1562
-
1563
- **Changed remote $id support** in `addRemoteSchema`. An `$id` has to be a valid url (previously any value was accepted)
1564
-
1565
- ### v9.0.0
1566
-
1567
- **breaking changes**:
1568
-
1569
- - _getSchema_ signature changed in favour of an options object. Instead of `draft.getNode(pointer, data)` arguments have to be passed as an object `draft.getNode({ pointer, data })`. This removes setting unwanted optional arguments and keeps the api more stable in the future (e.g. `withSchemaWarning` option)
1570
- - _JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
1571
-
1572
- **updates**
1573
-
1574
- - _getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
1575
-
1576
- ### v8.0.0
1577
-
1578
- With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
1579
-
1580
- - Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
1581
- - `getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
1582
- - Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
1583
- - Changed `unique-items-error` to point to error for duplicated item and changed data-properties
1584
- - Removed `SchemaService` as it was no longer used nor tested
1585
-
1586
- <details><summary>Exposed new helper functions</summary>
1587
-
1588
- - `mergeSchema` - Merges to two json schema
1589
- - `reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
1590
- - `isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
1591
- - `resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
1592
-
1593
- </details>