Skip to content

Commit

Permalink
- Made the classNames change a deprecation instead of a break
Browse files Browse the repository at this point in the history
- Restored description of `RJSFSchema`
  • Loading branch information
heath-freenome committed Aug 25, 2022
1 parent 142b829 commit cef4037
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/5.x upgrade guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There were several significant **breaking changes** in RJSF version 5 that were
- [#2858](https://github.com/rjsf-team/react-jsonschema-form/issues/2858)
- [#2905](https://github.com/rjsf-team/react-jsonschema-form/issues/2905)
- [#2945](https://github.com/rjsf-team/react-jsonschema-form/issues/2945)
- In the `uiSchema`, one [breaking change](https://react-jsonschema-form.readthedocs.io/en/stable/api-reference/uiSchema#breaking-change-in-version-5) was introduced to make `classNames` consistent with all other properties.
- In the `uiSchema`, one [deprecation warning](https://react-jsonschema-form.readthedocs.io/en/stable/api-reference/uiSchema#deprecation-in-version-5) was introduced to make `classNames` consistent with all other properties.
- As part of the fix for [#2526](https://github.com/rjsf-team/react-jsonschema-form/issues/2526) all the existing templates in the previous version were moved into a new `templates` dictionary, similar to how `widgets` and `fields` work
- This `templates` dictionary was added to the `Registry` and also the `Form` props, replacing the `ArrayFieldTemplate`, `FieldTemplate`, `ObjectFieldTemplate` and `ErrorList` props.
- In addition, several of the `fields` and `widgets` based components were moved into the `templates` dictionary as they were more like templates than true `Field`s or `Widget`s.
Expand Down Expand Up @@ -52,7 +52,7 @@ All the rest of the types for RJSF are now exported from the new `@rjsf/utils` p
NOTE: The types in `@rjsf/utils` have been improved significantly from those in version 4.
Some of the most notable changes are:
- `RJSFSchema` has replaced the use of `JSON7Schema` for future compatibility reasons.
- Currently `RJSFSchema` is an extension of `JSON7Schema` with support for the non-standard `enumNames` capability.
- Currently `RJSFSchema` is simply an alias to `JSON7Schema` so this change is purely a naming one.
- 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.
- `RJSFSchemaDefinition` has replaced the use of `JSONSchema7Definition` for the same reasons.
- The use of the generic `T` (defaulting to `any`) for the `formData` type has been expanded to cover all type hierarchies that use `formData`.
Expand Down
13 changes: 10 additions & 3 deletions docs/api-reference/uiSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,23 @@ Will result in:
</div>
```

#### BREAKING CHANGE in version 5
#### DEPRECATION in version 5
In versions previous to 5, `classNames` was the only property that did not require the `ui:` prefix.
Additionally, it did not support being added into the `ui:options` object.
This was fixed in version 5 to be consistent with all the other properties in this section.
If you were using `classNames` as follows, simply add the `ui:` prefix to it:

If you are using `classNames` as follows, simply add the `ui:` prefix to it to remove the deprecation warning that will be displayed for each `uiSchema.classNames` you have:

```jsx
const uiSchema = {
title: {
"classNames": "my class"
"classNames": "myClass"
}
};
// The uiSchema above will log a deprecation warning to the console, so use the following instead:
const uiSchema = {
title: {
"ui:classNames": "myClass"
}
};
```
Expand Down

0 comments on commit cef4037

Please sign in to comment.