You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add ui:definitions for recursive and reusable uiSchema (#4947)
* Added ui:definitions for recursive uiSchema support
* Added documentation
* added CHANGELOG entries for ui:definitions
* removed ui:definitions embedding, use registry instead
* added empty uiSchemaDefinitions if not present
* refactored expandUiSchemaDefinitions to use registry
* fixed registry tests
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ should change the heading of the (upcoming) version to include a major version b
30
30
## @rjsf/core
31
31
32
32
- Fixed duplicate React keys in datalist when schema examples and default have different types, fixing [#4927](https://github.com/rjsf-team/react-jsonschema-form/issues/4927)
33
+
- Integrated `ui:definitions` support for recursive and reusable uiSchema ([#4947](https://github.com/rjsf-team/react-jsonschema-form/pull/4947))
33
34
34
35
## @rjsf/daisyui
35
36
@@ -58,6 +59,16 @@ should change the heading of the (upcoming) version to include a major version b
58
59
## @rjsf/shadcn
59
60
60
61
- Fixed duplicate React keys in datalist when schema examples and default have different types, fixing [#4927](https://github.com/rjsf-team/react-jsonschema-form/issues/4927)
62
+
63
+
## @rjsf/utils
64
+
65
+
- Added `expandUiSchemaDefinitions()` and `resolveUiSchema()` functions, and `UiSchemaDefinitions` type to support defining reusable uiSchema for schema `$ref` references ([#4947](https://github.com/rjsf-team/react-jsonschema-form/pull/4947))
66
+
67
+
## Dev / docs / playground
68
+
69
+
- Updated References sample in playground to demonstrate `ui:definitions` feature ([#4947](https://github.com/rjsf-team/react-jsonschema-form/pull/4947))
70
+
- Added documentation for `ui:definitions` in `uiSchema.md` and `definitions.md` ([#4947](https://github.com/rjsf-team/react-jsonschema-form/pull/4947))
You can override specific properties from `ui:definitions` by providing values at the field path. Local values are merged with definitions, with local values taking precedence.
132
+
133
+
#### oneOf/anyOf with Same Property Names
134
+
135
+
When using `oneOf` or `anyOf` with branches that have properties with the same name, each branch's `$ref` maps to its own entry in `ui:definitions`, ensuring correct UI is applied:
Note that this library only supports local definition referencing. The value in the `$ref` keyword should be a [JSON Pointer](https://tools.ietf.org/html/rfc6901) in URI fragment identifier format.
32
+
33
+
## uiSchema for Schema Definitions
34
+
35
+
To customize the UI for schemas referenced via `$ref`, use the `ui:definitions` property in your uiSchema. This works for both reused and recursive schemas.
36
+
37
+
See [ui:definitions](../api-reference/uiSchema.md#uidefinitions) for full details and more examples.
0 commit comments