You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`evaluationPath` refers to the path in schema and is extended by `$ref`, e.g. if image is defined on `$defs`: `#/properties/image/$ref/properties/title`
118
-
-`schemaLocation` refers to the absolute path within the schema and will not change, e.g. `#/$defs/properties/title`
117
+
-`evaluationPath` refers to the path in schema and is extended by `$ref`, e.g. if image is defined on `$defs`: `#/properties/image/$ref/properties/title`
118
+
-`schemaLocation` refers to the absolute path within the schema and will not change, e.g. `#/$defs/properties/title`
119
119
120
120
</details>
121
121
@@ -163,17 +163,17 @@ _json-schema-library_ fully supports all core features of draft versions draft-0
163
163
164
164
Draft support is defined by running a validator against the official [json-schema-test-suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite).
165
165
166
-
- Test results for _json-schema-library_ can be inspected in [github actions](https://github.com/sagold/json-schema-library/actions/workflows/ci.yaml)
167
-
- A comparison to other validators is listed on [json-schema-benchmark](https://github.com/sagold/json-schema-benchmark)
166
+
-Test results for _json-schema-library_ can be inspected in [github actions](https://github.com/sagold/json-schema-library/actions/workflows/ci.yaml)
167
+
-A comparison to other validators is listed on [json-schema-benchmark](https://github.com/sagold/json-schema-benchmark)
168
168
169
169
Please note that these benchmarks refer to validation only. _json-schema-library_ offers tooling outside of validation and strives to be as spec-compliant as possible.
170
170
171
171
</details>
172
172
173
173
<details><summary>Overview format validation support</summary>
All returned json-errors have a data property with the following properties
633
633
634
-
-`pointer` JSON Pointer to the location where the error occured. In case of omitted data, this is the last JSON Schema location that could be resolved
635
-
-`schema` the JSON Schema of the last resolved location and the source of the error
636
-
-`value` the data value at this location that could not be resolved
634
+
-`pointer` JSON Pointer to the location where the error occured. In case of omitted data, this is the last JSON Schema location that could be resolved
635
+
-`schema` the JSON Schema of the last resolved location and the source of the error
636
+
-`value` the data value at this location that could not be resolved
637
637
638
638
```ts
639
639
const { error } =schemaNode.getNode("/list/1");
@@ -921,10 +921,10 @@ _json-schema-library_ uses the concept of **drafts** to support different versio
921
921
922
922
Each **draft** describes how a schema should be parsed, validated, and interpreted. Drafts can also be extended or modified to change or enhance behavior, such as:
923
923
924
-
- Replacing or adding new keywords (`oneOf`, `if/then`, custom ones, etc.)
925
-
- Defining or overriding format validators (`format: "email"`, etc.)
926
-
- Customizing or localizing error messages
927
-
- Tweaking how schema nodes behave during parsing or resolution
924
+
-Replacing or adding new keywords (`oneOf`, `if/then`, custom ones, etc.)
925
+
-Defining or overriding format validators (`format: "email"`, etc.)
926
+
-Customizing or localizing error messages
927
+
-Tweaking how schema nodes behave during parsing or resolution
928
928
929
929
Out of the box, the library exports all compliant JSON Schema drafts:
**Keywords** hold the main logic for JSON Schema functionality. Each `Keyword` corresponds to a JSON Schema keyword like `properties`, `prefixItems`, `oneOf`, etc and offers implementations to `parse`, `validate`, `resolve` and `reduce`. Note that support for each implementation is optional, dependending on the feature requirements. The main properties of a `Keyword`:
1125
1125
1126
-
- a `Keyword` is only processed if the specified `keyword` is available as property on the JSON Schema
1127
-
- an optional `order` property may be added as order of keyword execution is sometimes important (`additionalItems` last, `$ref` evaluation first)
1128
-
- the list of keywords is unique by property-value `keyword`
1129
-
- for a given function `addX`, a function `X` must be present
1126
+
-a `Keyword` is only processed if the specified `keyword` is available as property on the JSON Schema
1127
+
-an optional `order` property may be added as order of keyword execution is sometimes important (`additionalItems` last, `$ref` evaluation first)
1128
+
-the list of keywords is unique by property-value `keyword`
1129
+
-for a given function `addX`, a function `X` must be present
- replaced `node.additionalItems` by `node.items` for drafts below 2020-12
1300
+
- fixed `additionalItems` behaviour to be ignored when `schema.items` is not an array
1301
+
1297
1302
### v10.0.0
1298
1303
1299
1304
> 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.
@@ -1304,8 +1309,8 @@ The new implementation revolves around compiling schemas into a **SchemaNode** t
1304
1309
1305
1310
#### Key Changes:
1306
1311
1307
-
-**Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
1308
-
-**SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
1312
+
-**Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
1313
+
-**SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
-_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)
1358
-
-_JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
1362
+
-_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)
1363
+
-_JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
1359
1364
1360
1365
**updates**
1361
1366
1362
-
-_getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
1367
+
-_getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
1363
1368
1364
1369
### v8.0.0
1365
1370
1366
1371
With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
1367
1372
1368
-
- Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
1369
-
-`getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
1370
-
- Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
1371
-
- Changed `unique-items-error` to point to error for duplicated item and changed data-properties
1372
-
- Removed `SchemaService` as it was no longer used nor tested
1373
+
-Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
1374
+
-`getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
1375
+
-Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
1376
+
-Changed `unique-items-error` to point to error for duplicated item and changed data-properties
1377
+
-Removed `SchemaService` as it was no longer used nor tested
1373
1378
1374
1379
<details><summary>Exposed new helper functions</summary>
1375
1380
1376
-
-`mergeSchema` - Merges to two json schema
1377
-
-`reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
1378
-
-`isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
1379
-
-`resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
1381
+
-`mergeSchema` - Merges to two json schema
1382
+
-`reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
1383
+
-`isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
1384
+
-`resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
0 commit comments