Skip to content

Commit de51e62

Browse files
committed
publish: bump version to v10.1.0
1 parent a90ec68 commit de51e62

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

README.md

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ console.log(titleNode.evaluationPath); // #/properties/image/properties/title
114114
console.log(titleNode.schemaLocation); // #/properties/image/properties/title
115115
```
116116

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+
- `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`
119119

120120
</details>
121121

@@ -163,17 +163,17 @@ _json-schema-library_ fully supports all core features of draft versions draft-0
163163

164164
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).
165165

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)
168168

169169
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.
170170

171171
</details>
172172

173173
<details><summary>Overview format validation support</summary>
174174

175-
- **`❌ unsupported formats`** iri, iri-reference, idn-hostname
176-
- **`✅ supported formats`**: date, date-time, date, duration, ecmascript-regex, email, hostname, idn-email, ipv4, ipv6, json-pointer, regex, relative-json-pointer, time, unknown, uri-reference, uri-template, uri, uuid
175+
- **`❌ unsupported formats`** iri, iri-reference, idn-hostname
176+
- **`✅ supported formats`**: date, date-time, date, duration, ecmascript-regex, email, hostname, idn-email, ipv4, ipv6, json-pointer, regex, relative-json-pointer, time, unknown, uri-reference, uri-template, uri, uuid
177177

178178
</details>
179179

@@ -631,9 +631,9 @@ expect(node.schema).to.deep.equal({
631631

632632
All returned json-errors have a data property with the following properties
633633

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
637637

638638
```ts
639639
const { error } = schemaNode.getNode("/list/1");
@@ -921,10 +921,10 @@ _json-schema-library_ uses the concept of **drafts** to support different versio
921921

922922
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:
923923

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
928928

929929
Out of the box, the library exports all compliant JSON Schema drafts:
930930

@@ -1123,10 +1123,10 @@ console.assert(valid, errors.at(0)?.message);
11231123

11241124
**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`:
11251125

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
11301130

11311131
```ts
11321132
type Keyword = {
@@ -1294,6 +1294,11 @@ assert.deepEqual(errors[0].message, "Custom error 2");
12941294

12951295
## Breaking Changes
12961296

1297+
### v10.1.0
1298+
1299+
- 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+
12971302
### v10.0.0
12981303

12991304
> 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
13041309

13051310
#### Key Changes:
13061311

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.
13091314

13101315
#### Breaking Changes:
13111316

@@ -1321,14 +1326,14 @@ const node = compileSchema(schema);
13211326

13221327
**Changed Methods**:
13231328

1324-
- `draft.createSchemaOf(schema)``node.createSchema(schema)`
1325-
- `draft.each(data, callback)``const nodes = node.toDataNodes(data)`
1326-
- `draft.eachSchema(callback)``const nodes = node.toSchemaNodes()`
1327-
- `draft.getChildSchemaSelection(property)``node.getChildSelection(property)`
1328-
- `draft.getNode(options)``node.getNode(pointer, data, options)`
1329-
- `draft.getTemplate(inputData)``node.getData(inputData)`
1330-
- `draft.isValid(data)``node.validate(data).valid`
1331-
- `draft.step(property, data)``node.getNodeChild(property, data)`
1329+
- `draft.createSchemaOf(schema)``node.createSchema(schema)`
1330+
- `draft.each(data, callback)``const nodes = node.toDataNodes(data)`
1331+
- `draft.eachSchema(callback)``const nodes = node.toSchemaNodes()`
1332+
- `draft.getChildSchemaSelection(property)``node.getChildSelection(property)`
1333+
- `draft.getNode(options)``node.getNode(pointer, data, options)`
1334+
- `draft.getTemplate(inputData)``node.getData(inputData)`
1335+
- `draft.isValid(data)``node.validate(data).valid`
1336+
- `draft.step(property, data)``node.getNodeChild(property, data)`
13321337

13331338
**Renamed Properties**: `templateDefaultOptions``getDataDefaultOptions`
13341339

@@ -1354,28 +1359,28 @@ compileSchema(schema, {
13541359

13551360
**breaking changes**:
13561361

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
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
13591364

13601365
**updates**
13611366

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
13631368

13641369
### v8.0.0
13651370

13661371
With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
13671372

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
13731378

13741379
<details><summary>Exposed new helper functions</summary>
13751380

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.
13801385

13811386
</details>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-schema-library",
3-
"version": "10.0.0",
3+
"version": "10.1.0",
44
"description": "Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation",
55
"module": "dist/module/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)