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`
116
-
-`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`
117
119
118
120
</details>
119
121
@@ -161,17 +163,17 @@ _json-schema-library_ fully supports all core features of draft versions draft-0
161
163
162
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).
163
165
164
-
-Test results for _json-schema-library_ can be inspected in [github actions](https://github.com/sagold/json-schema-library/actions/workflows/ci.yaml)
165
-
-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)
166
168
167
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.
168
170
169
171
</details>
170
172
171
173
<details><summary>Overview format validation support</summary>
All returned json-errors have a data property with the following properties
631
633
632
-
-`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
633
-
-`schema` the JSON Schema of the last resolved location and the source of the error
634
-
-`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
635
637
636
638
```ts
637
639
const { error } =schemaNode.getNode("/list/1");
@@ -919,10 +921,10 @@ _json-schema-library_ uses the concept of **drafts** to support different versio
919
921
920
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:
921
923
922
-
-Replacing or adding new keywords (`oneOf`, `if/then`, custom ones, etc.)
923
-
-Defining or overriding format validators (`format: "email"`, etc.)
924
-
-Customizing or localizing error messages
925
-
-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
926
928
927
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`:
1123
1125
1124
-
-a `Keyword` is only processed if the specified `keyword` is available as property on the JSON Schema
1125
-
-an optional `order` property may be added as order of keyword execution is sometimes important (`additionalItems` last, `$ref` evaluation first)
1126
-
-the list of keywords is unique by property-value `keyword`
1127
-
-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
1128
1130
1129
1131
```ts
1130
1132
typeKeyword= {
@@ -1302,8 +1304,8 @@ The new implementation revolves around compiling schemas into a **SchemaNode** t
1302
1304
1303
1305
#### Key Changes:
1304
1306
1305
-
-**Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
1306
-
-**SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
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.
-_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)
1356
-
-_JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
1357
+
-_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
1357
1359
1358
1360
**updates**
1359
1361
1360
-
-_getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
1362
+
-_getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
1361
1363
1362
1364
### v8.0.0
1363
1365
1364
1366
With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
1365
1367
1366
-
-Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
1367
-
-`getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
1368
-
-Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
1369
-
-Changed `unique-items-error` to point to error for duplicated item and changed data-properties
1370
-
-Removed `SchemaService` as it was no longer used nor tested
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
1371
1373
1372
1374
<details><summary>Exposed new helper functions</summary>
1373
1375
1374
-
-`mergeSchema` - Merges to two json schema
1375
-
-`reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
1376
-
-`isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
1377
-
-`resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
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.
0 commit comments