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
* fix: Partially fix#3189
- Updated `@rjsf/utils` to make the `schema` and `rootSchema` props use a new generic type `S`
- Added the new `StrictRJSFSchema` type as the alias to `JSON7Schema` changing `RJSFSchema` to be `StrictRJSFSchema & GenericObjectType`
- Deleted the `RJSFSchemaDefinition` type in favor of accessing it indirectly via the `S["<prop-with-definition>"]` syntax
- Added the new generic `S extends StrictRJSFSchema = RJSFSchema` to all types that directly or indirectly used `RJSFSchema` after the `T = any` type
- Updated `SchemaUtilsType` to add the `F = any` generic to the whole interface, removing it from the definition of the two functions that need it
- Updated all functions that used `RJSFSchema` to take the new generic, replacing `RJSFSchema` with `S`
- Added missing generics where needed
- Updated `@rjsf/core` to insert the `S extends StrictRJSFSchema = RJSFSchema` to every component that needed it, after the `T = any` generic
- Updated the `index.ts` for the `ButtonTemplates`, `field`, `templates` and `widgets` to make them functions that take the `T`, `S` and `F` generics
- Updated `getDefaultRegistry()` and `templates()` to call the appropriate functions
- Replaced all uses of `RJSFSchema` and `RJSFSchemaDefinition` with `S` and `S["<prop-with-definition>"]`
- Added missing generics where needed
- Fixed a few type casts due the to the change in the `RJSFSchema` type
- Updated `@rjsf/validator-ajv6` to fix a few type casts due to the change in the `RJSFSchema` type
- Updated `@rjsf/validator-ajv8` to add the `S extends StrictRJSFSchema = RJSFSchema` generic to the `customizeValidator()` function and the `AJV8Validator` class
- Replaced all uses of `RJSFSchema` and `RJSFSchemaDefinition` with `S` and `S["<prop-with-definition>"]`
- Changed `RJSFSchema` to `S` where applicable
- Fixed a few type casts due the to the change in the `RJSFSchema` type
* Update packages/validator-ajv8/src/validator.ts
Fix comment
Co-authored-by: Nick Grosenbacher <[email protected]>
Co-authored-by: Nick Grosenbacher <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+18
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,24 @@ should change the heading of the (upcoming) version to include a major version b
20
20
## @rjsf/chakra-ui
21
21
- Automatically close single-choice Select widget on selection
22
22
23
+
## @rjsf/core
24
+
- Added the new generic, `S extends StrictRJSFSchema = RJSFSchema`, for `schema`/`rootSchema` to every component that needed it.
25
+
26
+
## @rjsf/utils
27
+
- Beta-only potentially BREAKING CHANGE: Changed all types that directly or indirectly defined `schema`/`rootSchema` to add the generic `S extends StrictRJSFSchema = RJSFSchema` and use `S` as the type for them.
28
+
-`StrictRJSFSchema` was added as the alias to `JSON7Schema` and `RJSFSchema` was modified to be `StrictRJSFSchema & GenericObjectType`
29
+
- This new generic was added BEFORE the newly added `F = any` generic because it is assumed that more people will want to change the schema than the formContext types
30
+
- This provides future support for the newer draft versions of the schema
31
+
32
+
## @rjsf/validator-ajv6
33
+
- Fixed a few type casts given the new expanded definition of the `RJSFSchema` type change
34
+
35
+
## @rjsf/validator-ajv8
36
+
- Updated the typing to add the new `S extends StrictRJSFSchema = RJSFSchema` generic and fixed up type casts
37
+
38
+
## Dev / docs / playground
39
+
- Updated the `5.x upgrade guide` to document the new `StrictRJSFSchema` and `S` generic
Copy file name to clipboardExpand all lines: docs/5.x upgrade guide.md
+15-15
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,11 @@ All the rest of the types for RJSF are now exported from the new `@rjsf/utils` p
42
42
NOTE: The types in `@rjsf/utils` have been improved significantly from those in version 4.
43
43
Some of the most notable changes are:
44
44
45
-
-`RJSFSchema` has replaced the use of `JSON7Schema` for future compatibility reasons.
46
-
- Currently `RJSFSchema` is simply an alias to `JSON7Schema` so this change is purely a naming one.
47
-
- It is highly recommended to update your use of `JSON7Schema` with `RJSFSchema` so that when the RJSF begins supporting a newer JSON Schema version out-of-the-box, your code won't be affected.
48
-
-`RJSFSchemaDefinition` has replaced the use of `JSONSchema7Definition` for the same reasons.
49
45
- The use of the generic `T` (defaulting to `any`) for the `formData` type has been expanded to cover all type hierarchies that use `formData`.
46
+
-`StrictRJSFSchema` and `RJSFSchema` have replaced the use of `JSON7Schema` for future compatibility reasons.
47
+
-`RJSFSchema` is `StrictRJSFSchema` joined with the `GenericObjectType` (i.e. `{ [key: string]: any }`) to allow for additional syntax related to newer draft versions
48
+
- All definitions of `schema` and `rootSchema` elements have been replaced with a generic that is defined as `S extends StrictRJSFSchema = RJSFSchema`
49
+
- It is highly recommended to update your use of `JSON7Schema` with `RJSFSchema` since that is the default for the new generic used for `schema` and `rootSchema`
50
50
- A new generic `F` (defaulting to `any`) was added for the `formContext` type, and all types in the hierarchy that use `formContext` have had that generic added to them.
51
51
- The new `CustomValidator`, `ErrorTransformer`, `ValidationData`, `ValidatorType` and `SchemaUtilsType` types were added to support the decoupling of the validation implementation.
52
52
- The new `TemplatesType`, `ArrayFieldDescriptionProps`, `ArrayFieldTitleProps`, `UnsupportedFieldProps`, `IconButtonProps`, `SubmitButtonProps` and `UIOptionsBaseType` were added to support the consolidation (and expansion) of `templates` in the `Registry` and `Form`.
@@ -362,21 +362,21 @@ For example, given a schema such as:
0 commit comments