Skip to content

Commit 319e1dc

Browse files
committed
docs: consolidate Changelog
1 parent 1752209 commit 319e1dc

2 files changed

Lines changed: 200 additions & 219 deletions

File tree

CHANGELOG.md

Lines changed: 199 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,243 @@
11
## Changelog
22

3-
- reference for error-format: https://json-schema.org/blog/posts/fixing-json-schema-output
3+
### v11.0.3
4+
5+
- fixed type of main input-schema to support boolean
6+
7+
### v11.0.2
8+
9+
- fixed `getNode` to always return a reduced JSON schema
10+
- fixed issues using reduce with `oneOfProperty`
11+
12+
### v11.0.1
13+
14+
- improved error reporting when using oneOfProperty-declarator
15+
16+
### v11.0.0
17+
18+
- introduced annotations
19+
- added node.createAnnotation helper
20+
- changed typing to strict
21+
- added annotations-list to `validate()` result
22+
- added keyword support for `deprecated: true` which returns a `deprecated-warning` annotation
23+
24+
**breaking changes**:
25+
26+
- Return type of validators is now `ValidationReturnType` instead of `ValidationResult`
27+
- type `AnnotationData` replaces `ErroData`
28+
29+
### v10.5.0
30+
31+
- added support for ref resolution in getSchemaType
32+
33+
### v10.4.0
34+
35+
- introduced esm module export
36+
- fixed typo in argument ~~disableRecusionLimit~~ disableRecursionLimit
37+
- added settings to exports for global changes of settings
38+
39+
### v10.3.0
40+
41+
- introduce setting `REGEX_FLAGS` and schema-property `regexFlags` to customize regex flags to use evaluating regex
42+
- fixed an issue resolving non-URI compatible $ref-targets containing `#/definitions`
43+
44+
### v10.2.0
45+
46+
- introduce getData setting `useTypeDefaults`
47+
- introduce support to merge meta-properties using $ref-resolution
48+
49+
### v10.1.0
50+
51+
- replaced `node.additionalItems` by `node.items` for drafts below 2020-12
52+
- fixed `additionalItems` behaviour to be ignored when `schema.items` is not an array
53+
54+
### v10.0.0
55+
56+
> 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.
57+
58+
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.
59+
60+
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.
61+
62+
#### Key Changes:
63+
64+
- **Compile Schema**: The `compileSchema` function now replaces the previous Draft-Class approach.
65+
- **SchemaNode Representation**: All schemas are now represented as `SchemaNode`, which holds the schema and provides an easier way to work with them.
66+
67+
#### Breaking Changes:
68+
69+
**`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.
70+
71+
```ts
72+
// PREVIOUSLY
73+
const draft = new Draft(schema);
74+
75+
// NOW
76+
const node = compileSchema(schema);
77+
```
78+
79+
**Changed Methods**:
80+
81+
- `draft.createSchemaOf(schema)``node.createSchema(schema)`
82+
- `draft.each(data, callback)``const nodes = node.toDataNodes(data)`
83+
- `draft.eachSchema(callback)``const nodes = node.toSchemaNodes()`
84+
- `draft.getChildSchemaSelection(property)``node.getChildSelection(property)`
85+
- `draft.getNode(options)``node.getNode(pointer, data, options)`
86+
- `draft.getTemplate(inputData)``node.getData(inputData)`
87+
- `draft.isValid(data)``node.validate(data).valid`
88+
- `draft.step(property, data)``node.getNodeChild(property, data)`
89+
90+
**Renamed Properties**: `templateDefaultOptions``getDataDefaultOptions`
91+
92+
**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`.
93+
94+
**Removed Error Property `name`**: Error property `name` has been removed from `JsonError` in favor of `code`.
95+
96+
**Removed Configuration Option**: The `templateDefaultOptions` property has been removed from the global settings object. You should now configure it using the `compileSchema` options:
97+
98+
```ts
99+
compileSchema(schema, {
100+
getDataDefaultOptions: {
101+
addOptionalProps: false,
102+
removeInvalidData: false,
103+
extendDefaults: true
104+
}
105+
});
106+
```
107+
108+
**Changed remote $id support** in `addRemoteSchema`. An `$id` has to be a valid url (previously any value was accepted)
4109

5110
### v9.0.0
6111

7-
- [Breaking] error data to always contain `schema` and `value`
8-
- [Breaking] getSchema arguments changed to options-object
9-
- [Add] withSchemaWarning option for getSchema to always return an error fpr undefined schema
112+
**breaking changes**:
113+
114+
- _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)
115+
- _JsonError_ now must expose `pointer`, `schema` and `value` consistently on data property
116+
117+
**updates**
118+
119+
- _getSchema_ consistently returns errors and can return errors for empty schema using `withSchemaWarning` option
10120

11121
### v8.0.0
12122

13-
- [Breaking] renamed `JSON` types and variables to `Json`
14-
- [Breaking] remove `oneOfSchema` helper property in favor of `getOneOfOrigin()` non-enumerable function
15-
- [Breaking] `getTemplate` will add only required properties per default. Use `addOptionalProps:true` to change this behaviour
16-
- [Breaking] change `unique-items-error` to point to error for duplicated item.
17-
- [add] introduce `mergeSchema`, `reduceSchema` and `resolveDynamicSchema`
18-
- [refactor] move dynamic resolvers `anyOf`, `allOf`, `oneOf`, `dependencies` and `if` to features modules
123+
With version `v8.0.0`, _getData_ was improved to better support optional properties and utilize existing core logic, making it more reliable. Breaking changes:
124+
125+
- Renamed `JSONError` to `JsonError` and `JSONSchema` to `JsonSchema`
126+
- `getData` only adds required properties. Behaviour can be changed by [getData default options](#getData-default-options)
127+
- Internal schema property `oneOfSchema` has been replaced by `schema.getOneOfOrigin()`
128+
- Changed `unique-items-error` to point to error for duplicated item and changed data-properties
129+
- Removed `SchemaService` as it was no longer used nor tested
130+
131+
<details><summary>Exposed new helper functions</summary>
132+
133+
- `mergeSchema` - Merges to two json schema
134+
- `reduceNode` - Reduce schema by merging dynamic constructs into a static json schema omitting those properties
135+
- `isDynamicSchema` - Returns true if the passed schema contains dynamic properties (_if_, _dependencies_, _allOf_, etc)
136+
- `resolveDynamicSchema` - Resolves all dynamic schema definitions for the given input data and returns the resulting JSON Schema without any dynamic schema definitions.
137+
138+
</details>
19139

20140
### 7.0.0
21141

22-
- changed core interface to draft for simpler configuration using a configuration map
142+
- changed core interface to draft for simpler configuration using a configuration map
23143

24144
**Breaking Changes**
25145

26-
- replaced `Core` interface by new `Draft` interface
27-
- changed export of `Interface` to `Draft`
28-
- changed export of `Interface` to `Draft`
29-
- renamed `addSchema` to `addRemoteSchema`
30-
- changed api of `compileSchema` to have an additional schema-parameter for rootSchema reference
31-
- changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
32-
- `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
33-
- removed direct export of following functions: `addValidator`, `compileSchema`, `createSchemaOf`, `each`, `eachSchema`, `getChildSchemaSelection`, `getSchema`, `getTemplate`, `isValid`, `step`, `validate`. They are still accessible under the draftConfigs of each draft-version
34-
- changed draft version of `JsonEditor` to draft07
146+
- replaced `Core` interface by new `Draft` interface
147+
- changed export of `Interface` to `Draft`
148+
- changed export of `Interface` to `Draft`
149+
- renamed `addSchema` to `addRemoteSchema`
150+
- changed api of `compileSchema` to have an additional schema-parameter for rootSchema reference
151+
- changed `compileSchema` and `addRemoteSchema` to work on instance state, instead of global state
152+
- `addRemoteSchema`, `compileSchema` now requires draft instance as first parameter
153+
- removed direct export of following functions: `addValidator`, `compileSchema`, `createSchemaOf`, `each`, `eachSchema`, `getChildSchemaSelection`, `getSchema`, `getTemplate`, `isValid`, `step`, `validate`. They are still accessible under the draftConfigs of each draft-version
154+
- changed draft version of `JsonEditor` to draft07
35155

36156
**Milestone**
37157

38-
- [] configurable and consistent draft api
39-
- [] expose all function under their draft-version
40-
- [] remove global states in remotes
158+
- [] configurable and consistent draft api
159+
- [] expose all function under their draft-version
160+
- [] remove global states in remotes
41161

42162
### 6.1.0
43163

44-
- [] Feature -- add support for dependencies in _getSchema_ and _getTemplate_
45-
- [] Feature -- added isJSONError type guard
46-
- fixe and improve types
164+
- [] Feature -- add support for dependencies in _getSchema_ and _getTemplate_
165+
- [] Feature -- added isJSONError type guard
166+
- fixe and improve types
47167

48168
### version 4.0
49169

50-
- [] Fix -- latest benchmark tests
51-
- [] Fix -- iterate schema (using typeDefs)
52-
- [] Fix -- scopes per schema-instance
53-
- [] Fix -- insane $ref resolution 'node' can be in 'root/node' or 'root/folder/node'
54-
- [] Refactor -- remove duplication from resolveRef.strict and resolveRef.withOverwrite
55-
- [] Change -- improve function apis (param order, rootSchema per default)
56-
- [] Fix -- `getTemplate` to resolve $ref to infinity
170+
- [] Fix -- latest benchmark tests
171+
- [] Fix -- iterate schema (using typeDefs)
172+
- [] Fix -- scopes per schema-instance
173+
- [] Fix -- insane $ref resolution 'node' can be in 'root/node' or 'root/folder/node'
174+
- [] Refactor -- remove duplication from resolveRef.strict and resolveRef.withOverwrite
175+
- [] Change -- improve function apis (param order, rootSchema per default)
176+
- [] Fix -- `getTemplate` to resolve $ref to infinity
57177

58178
**Breaking Changes**
59179

60-
- `iterateSchema` renamed to `eachSchema`
61-
- `validate` and `isValid` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
62-
- `validateAsync` changed signature from (schema, data, [pointer], [onError]) to (data, [{ schema, pointer, onError }])
63-
- `getTemplate` changed signature from (schema, data) to (data, [schema])
64-
- `getSchema` changed signature from (schema, data, [pointer]) to (pointer, [data], [schema])
65-
- `each` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
66-
- `resolveOneOf` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
67-
- `precompileSchema` renamed to `compileSchema`
180+
- `iterateSchema` renamed to `eachSchema`
181+
- `validate` and `isValid` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
182+
- `validateAsync` changed signature from (schema, data, [pointer], [onError]) to (data, [{ schema, pointer, onError }])
183+
- `getTemplate` changed signature from (schema, data) to (data, [schema])
184+
- `getSchema` changed signature from (schema, data, [pointer]) to (pointer, [data], [schema])
185+
- `each` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
186+
- `resolveOneOf` changed signature from (schema, data, [pointer]) to (data, [schema], [pointer])
187+
- `precompileSchema` renamed to `compileSchema`
68188

69189
**Milestone** consistent feature support
70190

71-
- [] no side-effects on added remote-schemas
72-
- [] rootSchema should always be compiled
73-
- [] Add missing support for allOf and anyOf type definitions in 'step' and 'getTemplate'
74-
- [] Complete schema support in iterateSchema
191+
- [] no side-effects on added remote-schemas
192+
- [] rootSchema should always be compiled
193+
- [] Add missing support for allOf and anyOf type definitions in 'step' and 'getTemplate'
194+
- [] Complete schema support in iterateSchema
75195

76196
## 2017
77197

78-
- [~] Features -- Improve validation maps to add & hook (!) custom entries (WIP, Add tests)
79-
- [] Fix -- Return all errors in oneOf-validation
80-
- [] Feature -- Error progress notification for async validation
81-
- [] Refactor -- Keyword validators should only be called for defined keyword
82-
- [] Feature -- getSchema of patternProperties
198+
- [~] Features -- Improve validation maps to add & hook (!) custom entries (WIP, Add tests)
199+
- [] Fix -- Return all errors in oneOf-validation
200+
- [] Feature -- Error progress notification for async validation
201+
- [] Refactor -- Keyword validators should only be called for defined keyword
202+
- [] Feature -- getSchema of patternProperties
83203

84204
**Milestone** add remaining draft04 features
85205

86-
- [] remote references
87-
- [] default format validations
88-
- [] definitions
89-
- [] dependencies
90-
- [] Features -- allOf
91-
- [] Features -- anyOf
92-
- [] Features -- type-array
93-
- [] Features -- patternProperties
94-
- [] Features -- uniqueItems
95-
- [] Features -- oneOf: fail for multiple matching oneof-schemas
96-
- [] Features -- oneOf: for non-arrays
97-
- [] Features -- required (array of properties). Currently every property is required by default
206+
- [] remote references
207+
- [] default format validations
208+
- [] definitions
209+
- [] dependencies
210+
- [] Features -- allOf
211+
- [] Features -- anyOf
212+
- [] Features -- type-array
213+
- [] Features -- patternProperties
214+
- [] Features -- uniqueItems
215+
- [] Features -- oneOf: fail for multiple matching oneof-schemas
216+
- [] Features -- oneOf: for non-arrays
217+
- [] Features -- required (array of properties). Currently every property is required by default
98218

99219
## 16/12
100220

101-
- [] Testing (validate real json files)
102-
- [] Test + document core differences
103-
- [] Add async validation
221+
- [] Testing (validate real json files)
222+
- [] Test + document core differences
223+
- [] Add async validation
104224

105225
**Milestone** customizable default and form (json-editor) validation
106226

107-
- [] Sanitize Errors
108-
- [] Features -- Add core: Form, fix core: Draft04 - by using separate functions
109-
- [] Add getTemplate to core (resolveOneOf)
110-
- [] Breaking -- Add sort of 'core' to customize validation, stepper, errors etc and reduce requried arguments
227+
- [] Sanitize Errors
228+
- [] Features -- Add core: Form, fix core: Draft04 - by using separate functions
229+
- [] Add getTemplate to core (resolveOneOf)
230+
- [] Breaking -- Add sort of 'core' to customize validation, stepper, errors etc and reduce requried arguments
111231

112232
**Milestone** custom validator (form-validation, oneOfProperty)
113233

114-
- [] Features -- additionalProperties: Boolean | Schema
115-
- [] Features -- additionalItems: Boolean | Schema
116-
- [] Features -- Add support for type "integer"
117-
- [] Features -- oneOf -> oneOfProperty ( + Documentation)
118-
- [] Breaking -- change isValid to return boolean
119-
- [] Breaking -- use `step` in isValid -- bad: circular dependencies with step -> guessOneOfSchema -> isValid --X-> step
120-
- [] Features -- items: [] schema (order/defined indices)
121-
- [] Features -- not
122-
- [] Features -- return custom errors in data validation
123-
- [] Basics
234+
- [] Features -- additionalProperties: Boolean | Schema
235+
- [] Features -- additionalItems: Boolean | Schema
236+
- [] Features -- Add support for type "integer"
237+
- [] Features -- oneOf -> oneOfProperty ( + Documentation)
238+
- [] Breaking -- change isValid to return boolean
239+
- [] Breaking -- use `step` in isValid -- bad: circular dependencies with step -> guessOneOfSchema -> isValid --X-> step
240+
- [] Features -- items: [] schema (order/defined indices)
241+
- [] Features -- not
242+
- [] Features -- return custom errors in data validation
243+
- [] Basics

0 commit comments

Comments
 (0)