Skip to content

Commit 79c7ae4

Browse files
- Responded to reviewer feedback and updated migration guide
1 parent 46fbe84 commit 79c7ae4

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

docs/5.x upgrade guide.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,33 @@ From v5, the child fields will correctly use the parent id when generating its o
262262

263263
##### Non-standard `enumNames` property
264264

265-
`enumNames` is a non-standard JSON Schema field that was deprecated in version 5. `enumNames` could be included in the schema to apply labels that differed from an enumeration value. This behavior can still be accomplished with `oneOf` or `anyOf` containing `const` values, so this behavior may be removed from a future major version of RJSF. For more information, see [#532](https://github.com/rjsf-team/react-jsonschema-form/issues/532).
265+
`enumNames` is a non-standard JSON Schema field that was deprecated in version 5.
266+
`enumNames` could be included in the schema to apply labels that differed from an enumeration value.
267+
This behavior can still be accomplished with `oneOf` or `anyOf` containing `const` values, so `enumNames` support may be removed from a future major version of RJSF.
268+
For more information, see [#532](https://github.com/rjsf-team/react-jsonschema-form/issues/532).
266269

270+
##### uiSchema.classNames
271+
272+
In versions previous to 5, `uiSchema.classNames` was the only property that did not require the `ui:` prefix.
273+
Additionally, it did not support being added into the `ui:options` object.
274+
This was fixed in version 5 to be consistent with all the other properties in the `uiSchema`, so the `uiSchema.classNames` support may be removed from a future major version of RJSF.
275+
276+
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:
277+
278+
```jsx
279+
// This uiSchema will log a deprecation warning to the console
280+
const uiSchema = {
281+
title: {
282+
"classNames": "myClass"
283+
}
284+
};
285+
// This uiSchema will not
286+
const uiSchema = {
287+
title: {
288+
"ui:classNames": "myClass"
289+
}
290+
};
291+
```
267292

268293
### `@rjsf/material-ui` BREAKING CHANGES
269294

packages/core/src/components/fields/SchemaField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ function SchemaFieldRender<T, F>(props: FieldProps<T, F>) {
258258
if (uiSchema?.classNames) {
259259
if (process.env.NODE_ENV !== "production") {
260260
console.warn(
261-
"WARNING: 'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead."
261+
"'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead."
262262
);
263263
}
264264
classNames.push(uiSchema.classNames);

packages/core/test/uiSchema_test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ describe("uiSchema", () => {
6262
expect(bar.classList.contains("another-for-bar")).eql(true);
6363
expect(baz.classList.contains("class-for-baz")).eql(true);
6464
expect(
65-
console.warn.calledWithMatch(
66-
/WARNING: 'uiSchema.classNames' is deprecated/
67-
)
65+
console.warn.calledWithMatch(/'uiSchema.classNames' is deprecated/)
6866
).to.be.true;
6967
});
7068
});

0 commit comments

Comments
 (0)