Skip to content

Commit bb2a654

Browse files
author
Sascha Goldhofer
committed
docs: update breaking changes and fix link
1 parent 678bad5 commit bb2a654

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
- [Breaking] remove `oneOfSchema` helper property in favor of `getOneOfOrigin()` non-enumerable function
55
- [Breaking] `getTemplate` will add only required properties per default. Use `addOptionalProps:true` to change this behaviour
66
- [Breaking] change `unique-items-error` to point to error for duplicated item.
7-
87
- [add] introduce `mergeSchema`, `reduceSchema` and `resolveDynamicSchema`
98
- [refactor] move dynamic resolvers `anyOf`, `allOf`, `oneOf`, `dependencies` and `if` to features modules
109

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const jsonSchema = new Draft07(myJsonSchema);
187187
const myData = jsonSchema.getTemplate({ name: "input-data" });
188188
```
189189

190-
**Note:** If you are using references in your schema, `getTemplate` will only resolve the first _$ref_ in each path, ensuring no inifinte data structures are created. In case the limit of **1** _$ref_ resolution is too low, you can modify the value globally one by adjusting the json-schema-library settings:
190+
**Note** If you are using references in your schema, `getTemplate` will only resolve the first _$ref_ in each path, ensuring no inifinte data structures are created. In case the limit of **1** _$ref_ resolution is too low, you can modify the value globally one by adjusting the json-schema-library settings:
191191

192192
```ts
193193
import { settings } from "json-schema-library";
@@ -435,7 +435,7 @@ expect(schemaOfItem).to.deep.equal({
435435

436436
This helper always returns a list of schemas.
437437

438-
**Note:** This helper currenly supports a subset of json-schema for multiple results, mainly _oneOf_-definitions
438+
**Note** This helper currenly supports a subset of json-schema for multiple results, mainly _oneOf_-definitions
439439

440440
```ts
441441
const jsonSchema = new Draft07(mySchema);
@@ -624,7 +624,7 @@ const compiledSchema = jsonSchema.compileSchema({ $ref: "/$defs/table" });
624624
const tableSchema = compiledSchema.getRef();
625625
```
626626

627-
**Note:** that `draft.compileSchema` compiles a schema under the current rootSchema. That is, definitions from root schema will be copied to the local schema, to enable _$ref_ resolutions.
627+
**Note** that `draft.compileSchema` compiles a schema under the current rootSchema. That is, definitions from root schema will be copied to the local schema, to enable _$ref_ resolutions.
628628

629629
## Draft extensions
630630

@@ -671,7 +671,7 @@ expect(resolvedSchema).to.deep.eq({
671671

672672
## Draft customization
673673

674-
[getTemplate default options](#get-template-default-options) | [custom resolvers](#custom-resolvers) | [custom validators](#custom-validators) | [custom errors](#custom-errors)
674+
[getTemplate default options](#gettemplate-default-options) | [custom resolvers](#custom-resolvers) | [custom validators](#custom-validators) | [custom errors](#custom-errors)
675675

676676
Each `Draft` in `json-schema-library` is build around a [DraftConfig](./lib/draft/index.ts#19). A `DraftConfig` holds all _functions_ and _configurations_ for each json-schema drafts. The `DraftConfig` is your main way to alter or extend behaviour for `json-schema-library`. You can either create your own _draftConfig_ or adjust any existing _draftConfig_. For the current drafts (4-7), each _draftConfig_ is exposed along with its actual _class_. For example:
677677

@@ -699,18 +699,18 @@ new Draft({ ...draft07Config, resolveOneOf: resolveOneOfFuzzy }, mySchema);
699699

700700
With **version 8** _json-schema-library_ has changed `getTemplate` to only add required properties per default. This can be changed on draft initialization, by passing `templateDefaultOptions` in the _draftConfig_:
701701

702-
```js
702+
```ts
703703
const draft = new Draft(schema, {
704704
templateDefaultOptions: {
705705
addOptionalProps: true
706706
}
707707
});
708708
```
709709

710-
**Note:** You can still pass options to getTemplate overriding the draft default settings by:
710+
**Note** You can still pass options to getTemplate overriding the draft default settings by:
711711

712-
```js
713-
const data = draft.getTemplate(data, draft.getSchema(), {
712+
```ts
713+
const data = draft.getTemplate({}, draft.getSchema(), {
714714
addOptionalProps: true
715715
});
716716
```
@@ -921,9 +921,12 @@ const error: JsonError = createError("EnumError", { data: { pointer: "#/location
921921

922922
### v8.0.0
923923

924+
With version `v8.0.0`, _getTemplate_ was improved to better support optional properties and utilize existing core logic, making it more reliable.
925+
924926
- Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
925-
- `getTemplate` only adds required properties. Behaviour can be changed by [getTemplate default options](#get-template-default-options)
927+
- `getTemplate` only adds required properties. Behaviour can be changed by [getTemplate default options](#gettemplate-default-options)
926928
- internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
929+
- Changed `unique-items-error` to point to error for duplicated item and changed data-properties
927930

928931
### v7.0.0
929932

0 commit comments

Comments
 (0)