Skip to content

Commit 828331b

Browse files
Replace json-schema-merge-allof with @x0k/json-schema-merge (#4881)
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
1 parent ae7c9f0 commit 828331b

File tree

23 files changed

+71
-133
lines changed

23 files changed

+71
-133
lines changed

CHANGELOG.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,30 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
1515
should change the heading of the (upcoming) version to include a major version bump.
1616
1717
-->
18+
1819
# 6.1.2
1920

2021
## @rjsf/antd
2122

2223
- Updated `SelectWidget` to add a static `getPopupContainerCallback` to the `SelectWidget` component, partially fixing [#3609](https://github.com/rjsf-team/react-jsonschema-form/issues/3609)
23-
- Also, added the explicit `open` state to the `Select` in conjunction with providing the `setOpen` as the `onOpenChange` prop
24+
- Also, added the explicit `open` state to the `Select` in conjunction with providing the `setOpen` as the `onOpenChange` prop
25+
- In `BaseInputTemplate` added comments explaining why `step='1'` is returned, closing [#4022](https://github.com/rjsf-team/react-jsonschema-form/issues/4022)
2426

2527
## @rjsf/mantine
2628

2729
- Align Mantine’s behavior with other themes when clearing string fields: clearing an input now removes the key from formData instead of setting it to an empty string. ([#4875](https://github.com/rjsf-team/react-jsonschema-form/pull/4875))
2830

31+
## @rjsf/utils
32+
33+
- Replace json-schema-merge-allof with [@x0k/json-schema-merge](https://github.com/x0k/json-schema-merge/) ([#4774](https://github.com/rjsf-team/react-jsonschema-form/issues/4774))
34+
2935
## Dev / docs / playground
3036

3137
- Updated `DemoFrame` as follows to fix [#3609](https://github.com/rjsf-team/react-jsonschema-form/issues/3609)
3238
- Override `antd`'s `SelectWidget.getPopupContainerCallback` callback function to return undefined
3339
- Added a `AntdSelectPatcher` component that observes the creation of `antd` select dropdowns and makes sure they open in the correct location
3440
- Update the `antd` theme wrapper to render the `AntdSelectPatcher`, `AntdStyleProvider` and `ConfigProvider` with it's own `getPopupContainer()` function inside of a `FrameContextConsumer`
41+
- Updated TypeScript configuration to use `"moduleResolution": "bundler"`
3542

3643
# 6.1.1
3744

@@ -197,7 +204,7 @@ should change the heading of the (upcoming) version to include a major version b
197204
- Updated the `OptionsDrawer` of the playground to add `idPrefix` and `idSeparator` fields
198205
- Updated test files to switch to using the React Testing library instead of `react-test-renderer`, updating all snapshots accordingly
199206
- Updated Fluent libraries to latest, with updated snapshots
200-
- Added Node 24 to `ci.yml`, removing `v5` and old Node 14 non-docs builds
207+
- Added Node 24 to `ci.yml`, removing `v5` and old Node 14 non-docs builds
201208

202209
# 6.0.1
203210

@@ -218,7 +225,7 @@ should change the heading of the (upcoming) version to include a major version b
218225
## @rjsf/core
219226

220227
- Updated `SchemaField` to add a new optional property `childFieldPathId` to the `FieldComponent` render to prevent duplicate ids, fixing (#4819)[https://github.com/rjsf-team/react-jsonschema-form/issues/4819]
221-
- Also updated `ObjectField` and `ArrayField` to make children use the `childFieldPathId` if present, falling back to the `fieldPathId` if not
228+
- Also updated `ObjectField` and `ArrayField` to make children use the `childFieldPathId` if present, falling back to the `fieldPathId` if not
222229

223230
## Dev / docs / playground
224231

@@ -245,7 +252,7 @@ should change the heading of the (upcoming) version to include a major version b
245252
- Updated `Form` to support the new feature to do `onBlur` handling of `liveValidate` and `liveOmit`
246253
- Updated `FormProps` to add the new `initialFormData` prop
247254
- Updated `Form` so that is behaves as a "controlled" form when `formData` is passed and uncontrolled when `initialFormData` is passed, fixing [#391](https://github.com/rjsf-team/react-jsonschema-form/issues/391)
248-
- Also fixed an issue where live validation was called on the initial form render, causing errors to show immediately, partially fixing [#512](https://github.com/rjsf-team/react-jsonschema-form/issues/512)
255+
- Also fixed an issue where live validation was called on the initial form render, causing errors to show immediately, partially fixing [#512](https://github.com/rjsf-team/react-jsonschema-form/issues/512)
249256
- Updated `Form` to add a new programmatic function, `setFieldValue(fieldPath: string | FieldPathList, newValue?: T): void`, fixing [#2099](https://github.com/rjsf-team/react-jsonschema-form/issues/2099)
250257
- Added new `FallbackField` to add opt-in functionality to control form data that is of an unsupported or unknown type ([#4736](https://github.com/rjsf-team/react-jsonschema-form/issues/4736)).
251258
- Refactored much of the `FileWidget` implementation into a new `useFileWidgetProps()` hook, fixing [#3146](https://github.com/rjsf-team/react-jsonschema-form/issues/3146)
@@ -384,7 +391,7 @@ should change the heading of the (upcoming) version to include a major version b
384391
- Updated the `customArray` sample to refactor out a `ArrayFieldItemButtonsTemplate`
385392
- Updated the `custom-templates.md` documentation to reflect the `additionalProperties`-based interface props replacement and `ArrayField` conversion changes
386393
- Updated the `utility-functions.md` documentation to add the new `useDeepCompareMemo()` hook
387-
- Updated the `v6.x upgrade guide.md` documentation to add the BREAKING CHANGES to the `ArrayFieldTemplateProps`, `ArrayFieldItemTemplateType`, `ArrayFieldItemButtonsTemplateType`, `FieldTemplateProps`, `ObjectFieldTemplateProps` and `WrapIfAdditionalTemplateProps` interface props changes and the `useDeepCompareMemo()` hook
394+
- Updated the `v6.x upgrade guide.md` documentation to add the BREAKING CHANGES to the `ArrayFieldTemplateProps`, `ArrayFieldItemTemplateType`, `ArrayFieldItemButtonsTemplateType`, `FieldTemplateProps`, `ObjectFieldTemplateProps` and `WrapIfAdditionalTemplateProps` interface props changes and the `useDeepCompareMemo()` hook
388395
- Added documentation for the `nameGenerator` prop in `form-props.md` and v6.x upgrade guide
389396
- Updated `@rjsf/snapshot-tests` package to explicitly depend on `@rjsf/core` to build first, fixing an error with parallelized builds
390397

@@ -411,11 +418,11 @@ should change the heading of the (upcoming) version to include a major version b
411418
- Updated `ArrayFieldTemplate`, `ObjectFieldTemplate`, `TitleField` to add support for the new `optionalDataControl` feature
412419
- Added the new `OptionalDataControlTemplate` to the theme, adding it to the `templates` list
413420
- Updated `Form` as follows to fix [#4796](https://github.com/rjsf-team/react-jsonschema-form/issues/4796)
414-
- Refactored the `liveValidate()` and `mergeErrors()` functions out of `getStateFromProp()` and `processPendingChange()`
415-
- Added new, optional `customErrors?: ErrorSchemaBuilder<T>` to the `FormState`, updating the `IChangeEvent` interface to remove all of the private variables
416-
- Reworked the `newErrorSchema` handling in `processPendingChange()` to simplify the handling since `newErrorSchema` is now path-specific, adding `newErrorSchema` to `customErrors` when they don't match an existing validator-based validation
417-
- This rework resulted in any custom errors passed from custom widgets/fields will now be remembered during the validation stage
418-
- Removed the now unused `getPreviousCustomValidateErrors()` and `filterErrorsBasedOnSchema()` methods
421+
- Refactored the `liveValidate()` and `mergeErrors()` functions out of `getStateFromProp()` and `processPendingChange()`
422+
- Added new, optional `customErrors?: ErrorSchemaBuilder<T>` to the `FormState`, updating the `IChangeEvent` interface to remove all of the private variables
423+
- Reworked the `newErrorSchema` handling in `processPendingChange()` to simplify the handling since `newErrorSchema` is now path-specific, adding `newErrorSchema` to `customErrors` when they don't match an existing validator-based validation
424+
- This rework resulted in any custom errors passed from custom widgets/fields will now be remembered during the validation stage
425+
- Removed the now unused `getPreviousCustomValidateErrors()` and `filterErrorsBasedOnSchema()` methods
419426
- Updated `LayoutGridField` to simplify `onFieldChange()` to just return the given `errorSchema` now that it is path-specific, fixing [#4796](https://github.com/rjsf-team/react-jsonschema-form/issues/4796)
420427
- Updated `NullField` to pass `fieldPathId.path` for the `onChange()` instead of `[name]`
421428

@@ -476,7 +483,7 @@ should change the heading of the (upcoming) version to include a major version b
476483
- Updated `GlobalFormOptions` to add new `enableOptionalDataFieldForType?: ('object' | 'array')[]` prop
477484
- Updated `SchemaUtilsType`'s `retrieveSchema()` function to add an additional, property `resolveAnyOfOrOneOfRefs?: boolean`
478485
- Updated the `Templates` interface to add a new required template `OptionalDataControlsTemplate: ComponentType<OptionalDataControlsTemplateProps<T, S, F>>`
479-
- Updated `retrieveSchema()` to add an additional property `resolveAnyOfOrOneOfRefs?: boolean` which causes `resolveAllSchemas()` to resolve `$ref`s inside of the options of `anyOf`/`oneOf` schemas
486+
- Updated `retrieveSchema()` to add an additional property `resolveAnyOfOrOneOfRefs?: boolean` which causes `resolveAllSchemas()` to resolve `$ref`s inside of the options of `anyOf`/`oneOf` schemas
480487
- Updated `getDefaultFormState` to fix an issue where optional array props had their default set to an empty array when they shouldn't be
481488
- Updated the `TranslatableString` enum to add three new strings in support of the new feature: `OptionalObjectAdd`, `OptionalObjectRemove` and `OptionalObjectEmptyMsg`
482489
- Added four new utility functions: `isFormDataAvailable()`, `isRootSchema()`, `optionalControlsId()`, and `shouldRenderOptionalField()`

package-lock.json

Lines changed: 10 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/antd/jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"moduleNameMapper": {
99
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
1010
},
11-
"transformIgnorePatterns": ["/node_modules/(?!deep-freeze-es6)"]
11+
"transformIgnorePatterns": ["/node_modules/(?!(@x0k/json-schema-merge|deep-freeze-es6))"]
1212
}

packages/chakra-ui/jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"browsers": ["chrome", "firefox", "safari"]
66
},
77
"setupFilesAfterEnv": ["./test/setup-jest-env.js", "../../testing/testSetup.ts"],
8-
"transformIgnorePatterns": ["/node_modules/(?!deep-freeze-es6)"]
8+
"transformIgnorePatterns": ["/node_modules/(?!(@x0k/json-schema-merge|deep-freeze-es6))"]
99
}

packages/core/jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"testEnvironment": "jsdom",
44
"setupFilesAfterEnv": ["./test/setup-jest-env.js", "../../testing/testSetup.ts"],
55
"testMatch": ["**/test/**/*.test.[jt]s?(x)"],
6-
"transformIgnorePatterns": ["/node_modules/(?!deep-freeze-es6)"]
6+
"transformIgnorePatterns": ["/node_modules/(?!(@x0k/json-schema-merge|deep-freeze-es6))"]
77
}

packages/daisyui/jest.config.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"^.+\\.(t|j)sx?$": "babel-jest"
77
},
88
"coveragePathIgnorePatterns": ["/node_modules/", "/test/"],
9-
"transformIgnorePatterns": [
10-
"/node_modules/(?!(@fortawesome|yup|react-day-picker|dayjs|deep-freeze-es6)/)"
11-
],
9+
"transformIgnorePatterns": ["/node_modules/(?!(@x0k|@fortawesome|yup|react-day-picker|dayjs|deep-freeze-es6)/)"],
1210
"moduleNameMapper": {
1311
"\\.(css|less|scss|sass)$": "<rootDir>/test/fileMock.js"
1412
}

packages/docs/docs/advanced-customization/internals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This component follows [JSON Schema](http://json-schema.org/documentation.html)
1616

1717
You can also use `oneOf` with [schema dependencies](../json-schema/dependencies.md#schema-dependencies) to dynamically add schema properties based on input data.
1818

19-
The `allOf` keyword is supported; it uses [json-schema-merge-allof](https://github.com/mokkabonna/json-schema-merge-allof) to merge subschemas to render the final combined schema in the form. When these subschemas are incompatible, though (or if the library has an error merging it), the `allOf` keyword is dropped from the schema.
19+
The `allOf` keyword is supported; it uses [@x0k/json-schema-merge](https://github.com/x0k/json-schema-merge/) to merge subschemas to render the final combined schema in the form. When these subschemas are incompatible, though (or if the library has an error merging it), the `allOf` keyword is dropped from the schema.
2020

2121
- `"additionalProperties":false` produces incorrect schemas when used with [schema dependencies](../json-schema/dependencies.md#schema-dependencies). This library does not remove extra properties, which causes validation to fail. It is recommended to avoid setting `"additionalProperties":false` when you use schema dependencies. See [#848](https://github.com/rjsf-team/react-jsonschema-form/issues/848) [#902](https://github.com/rjsf-team/react-jsonschema-form/issues/902) [#992](https://github.com/rjsf-team/react-jsonschema-form/issues/992)
2222

packages/docs/docs/api-reference/form-props.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ NOTE: If there is a default for a field and the `formData` is unspecified, the d
284284

285285
## experimental_customMergeAllOf
286286

287-
The `experimental_customMergeAllOf` function allows you to provide a custom implementation for merging `allOf` schemas. This can be particularly useful in scenarios where the default [json-schema-merge-allof](https://github.com/mokkabonna/json-schema-merge-allof) library becomes a performance bottleneck, especially with large and complex schemas or doesn't satisfy your needs.
287+
The `experimental_customMergeAllOf` function allows you to provide a custom implementation for merging `allOf` schemas. This can be particularly useful in case the where the default merge library ([@x0k/json-schema-merge](https://github.com/x0k/json-schema-merge/)) doesn't satisfy your functional or performance requirements.
288288

289289
By providing your own implementation, you can potentially achieve significant performance improvements. For instance, if your use case only requires a subset of JSON Schema features, you can implement a faster, more tailored merging strategy.
290290

0 commit comments

Comments
 (0)