Skip to content

Commit 0a25a89

Browse files
committed
docs: update brealing changes format
1 parent a214dc8 commit 0a25a89

File tree

1 file changed

+28
-66
lines changed

1 file changed

+28
-66
lines changed

README.md

Lines changed: 28 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ schemaNode.getData({}); // { character: "A" } - default value resolved
228228
const { node, error } = schemaNode.getNodeRef("https://sagold.com/remote");
229229
```
230230

231-
**Note** the support for $ref resolution has additional complexities, if you add nested $ids to you schema. Here, json-schema-library has only partial support ([@see integration test result](https://github.com/sagold/json-schema-library/actions/runs/4037856805/jobs/6941448741)). Thus, it is recommended to omit the features of changing scopes by nested $ids. For more details, see [json-schema.org: Structuring a complex schema](https://json-schema.org/understanding-json-schema/structuring.html#base-uri).
231+
**Note** JSON Schema $ref-keyword can become tricky when combined with $ids in sub-schemas. For more details, see [json-schema.org: Structuring a complex schema](https://json-schema.org/understanding-json-schema/structuring.html#base-uri).
232232

233233
<details><summary>Adding remote schema to compileSchema</summary>
234234

@@ -735,7 +735,7 @@ expect(reducedNode.schema).to.deep.eq({
735735
```
736736

737737
> ⚠️ Please be aware that certain schema-definitions are lost when resolving or merging sub-schemas.
738-
This mainly refers to validation-properties, but also some ambigiuous schema might get overriden.
738+
> This mainly refers to validation-properties, but also some ambigiuous schema might get overriden.
739739
740740
### toDataNodes
741741

@@ -1193,6 +1193,8 @@ expect(resolvedNode?.schema).to.deep.eq({
11931193

11941194
### v10.0.0
11951195

1196+
> 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.
1197+
11961198
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.
11971199

11981200
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.
@@ -1204,8 +1206,7 @@ The new implementation revolves around compiling schemas into a **SchemaNode** t
12041206

12051207
#### Breaking Changes:
12061208

1207-
- **`compileSchema`** is now a standalone function and replaces the `Draft` class.
1208-
- All return values for JSON Schema are now `SchemaNode` objects that contain a `schema` property.
1209+
**`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.
12091210

12101211
```ts
12111212
// PREVIOUSLY
@@ -1215,44 +1216,36 @@ The new implementation revolves around compiling schemas into a **SchemaNode** t
12151216
const node = compileSchema(schema);
12161217
```
12171218

1218-
- **Changed Methods**:
1219-
1220-
- `draft.createSchemaOf(schema)``node.createSchema(schema)`
1221-
- `draft.each(data, callback)``const nodes = node.toDataNodes(data)`
1222-
- `draft.eachSchema(callback)``const nodes = node.toSchemaNodes()`
1223-
- `draft.getChildSchemaSelection(property)``node.getChildSelection(property)`
1224-
- `draft.getNode(options)``node.getNode(pointer, data, options)`
1225-
- `draft.getTemplate(inputData)``node.getData(inputData)`
1226-
- `draft.isValid(data)``node.validate(data).valid`
1227-
- `draft.step(property, data)``node.getNodeChild(property, data)`
1219+
**Changed Methods**:
12281220

1229-
- **Renamed Properties**:
1221+
- `draft.createSchemaOf(schema)``node.createSchema(schema)`
1222+
- `draft.each(data, callback)``const nodes = node.toDataNodes(data)`
1223+
- `draft.eachSchema(callback)``const nodes = node.toSchemaNodes()`
1224+
- `draft.getChildSchemaSelection(property)``node.getChildSelection(property)`
1225+
- `draft.getNode(options)``node.getNode(pointer, data, options)`
1226+
- `draft.getTemplate(inputData)``node.getData(inputData)`
1227+
- `draft.isValid(data)``node.validate(data).valid`
1228+
- `draft.step(property, data)``node.getNodeChild(property, data)`
12301229

1231-
- `templateDefaultOptions``getDataDefaultOptions`
1230+
**Renamed Properties**: `templateDefaultOptions``getDataDefaultOptions`
12321231

1233-
- **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`.
1232+
**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`.
12341233

1235-
- **Removed Error Property `name`**:
1236-
Error property `name` has been removed from `JsonError` in favor of `code`.
1234+
**Removed Error Property `name`**: Error property `name` has been removed from `JsonError` in favor of `code`.
12371235

1238-
- **Removed Configuration Option**:
1239-
The `templateDefaultOptions` property has been removed from the global settings object. You should now configure it using the `compileSchema` options:
1240-
1241-
```ts
1242-
compileSchema(schema, {
1243-
getDataDefaultOptions: {
1244-
addOptionalProps: false,
1245-
removeInvalidData: false,
1246-
extendDefaults: true
1247-
}
1248-
});
1249-
```
1236+
**Removed Configuration Option**: The `templateDefaultOptions` property has been removed from the global settings object. You should now configure it using the `compileSchema` options:
12501237

1251-
- **Changed remote $id support** in `addRemoteSchema`. An `$id` has to be a valid url (previously any value was accepted)
1252-
1253-
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.
1238+
```ts
1239+
compileSchema(schema, {
1240+
getDataDefaultOptions: {
1241+
addOptionalProps: false,
1242+
removeInvalidData: false,
1243+
extendDefaults: true
1244+
}
1245+
});
1246+
```
12541247

1255-
This format should help users quickly understand the changes, what has been renamed, and how to adapt to the new API.
1248+
**Changed remote $id support** in `addRemoteSchema`. An `$id` has to be a valid url (previously any value was accepted)
12561249

12571250
### v9.0.0
12581251

@@ -1283,34 +1276,3 @@ With version `v8.0.0`, _getData_ was improved to better support optional propert
12831276
- `resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
12841277

12851278
</details>
1286-
1287-
### v7.0.0
1288-
1289-
With version `v7.0.0`, library export and Draft API has changed heavily. The API is now more consistent across draft-versions and offers a simple and consistent configuration interface for existing and custom drafts. In addition, most standalone functions are no longer exposed separately, but under its current _draftConfigs_ and mainly on each draft-instance. This will help to reduce confusion when consuming this API.
1290-
1291-
The above documentation reflects all these changes. Just reach out if you have troubles migrating to the latest version.
1292-
1293-
<details><summary>Details of breaking changes</summary>
1294-
1295-
- replaced `Core` interface by new `Draft` interface
1296-
- changed export of `Interface` to `Draft`
1297-
- renamed `addSchema` to `addRemoteSchema`
1298-
- changed API of `compileSchema` to have an additional schema-parameter for rootSchema reference
1299-
- changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
1300-
- `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
1301-
- removed direct export of following functions: `addValidator`, `compileSchema`, `createSchemaOf`, `each`, `eachSchema`, `getNodeChildSchemaSelection`, `getNode`, `getData`, `isValid`, `step`, `validate`. They are still accessible under the draftConfigs of each draft-version
1302-
- changed draft version of `JsonEditor` to draft07
1303-
1304-
</details>
1305-
1306-
### v6.0.0
1307-
1308-
With version `v6.0.0` supported json schema drafts are exported directly as `Draft04`, `Draft06`, `Draft07`. Example use: `import { Draft07 } from "json-schema-library"`.
1309-
1310-
### v5.0.0
1311-
1312-
With version `v5.0.0` the API has changed to es6 modules, where there is no `default` export, only named exports. Additionally all code has been rewritten in TypeScript. When directly accessing files, switch to `dist/module/*.js`-files for plain js-modules.
1313-
1314-
### v4.0.0
1315-
1316-
With version `v4.0.0` the API has changed in order to use the defined (root) schema in draft as default where possible. This means most methods have a changed signature, where `data` is passed before an optional `schema` argument.

0 commit comments

Comments
 (0)