Skip to content

Commit 2a261a3

Browse files
- Responded to reviewer feedback
1 parent f92badc commit 2a261a3

File tree

1 file changed

+145
-8
lines changed

1 file changed

+145
-8
lines changed

packages/docs/docs/migration-guides/v6.x upgrade guide.md

Lines changed: 145 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,38 +100,175 @@ The following deprecations were removed from the code base in v6
100100

101101
#### FormProps.acceptcharset
102102

103-
Use `FormProps.acceptCharset` instead
103+
The `acceptcharset` prop on `Form` was removed. Use the `acceptCharset` prop instead. I.e.:
104+
105+
```tsx
106+
<Form acceptCharset='ISO-8859-1' />
107+
```
104108

105109
#### getMatchingOption()
106110

107-
Use the `@rjsf/utils` function `getFirstMatchingOption()` instead.
111+
The `getMatchingOption()` function in `@rjsf/utils` was removed. Use the `getFirstMatchingOption()` function instead.
112+
I.e.:
113+
114+
```ts
115+
import { getFirstMatchingOption, RJSFSchema } from '@rjsf/utils';
116+
import validator from '@rjsf/validator-ajv8';
117+
118+
const schema: RJSFSchema = {
119+
// your schema goes here
120+
};
121+
122+
const formData = {
123+
/* your form data goes here */
124+
};
125+
const options: RJSFSchema[] = [
126+
/* your options extracted from the schema go here */
127+
];
128+
129+
const option = getFirstMatchingOption(validator, formData, options, schema);
130+
```
108131

109132
#### SchemaUtilsType.getMatchingOption()
110133

111-
Use `SchemaUtilsType.getFirstMatchingOption()` instead.
134+
The `getMatchingOption()` function in the `SchemaUtilsType` was removed. Use the `getFirstMatchingOption()` on the type
135+
instead. I.e.:
136+
137+
```ts
138+
import { createSchemaUtils, RJSFSchema } from '@rjsf/utils';
139+
import validator from '@rjsf/validator-ajv8';
140+
141+
const schema: RJSFSchema = {
142+
// your schema goes here
143+
};
144+
145+
const formData = {
146+
/* your form data goes here */
147+
};
148+
const options: RJSFSchema[] = [
149+
/* your options extracted from the schema go here */
150+
];
151+
const schemaUtils = createSchemaUtils(validator, schema);
152+
153+
const option = schemaUtils.getFirstMatchingOption(formData, options);
154+
```
112155

113156
#### mergeValidationData()
114157

115-
Use the `@rjsf/utils` function `validationDataMerge()` instead.
158+
The `mergeValidationData()` function from `@rjsf/utils` was removed. Use the `validationDataMerge()` function instead.
159+
I.e.:
160+
161+
```ts
162+
import { validationDataMerge, ValidationData, ErrorSchema } from '@rjsf/utils';
163+
164+
const validationData: ValidationData = {
165+
errors: [
166+
/* Your validation errors go here */
167+
],
168+
errorSchema: {
169+
/* Your error schema goes here */
170+
},
171+
};
172+
173+
const additionalErrorSchema: ErrorSchema = {
174+
/* Your additional error schema goes here */
175+
};
176+
177+
const merged = validationDataMerge(validationData, additionalErrorSchema);
178+
```
116179

117180
#### SchemaUtilsType.mergeValidationData()
118181

119-
Use `SchemaUtilsType.validationDataMerge()` instead.
182+
The `mergeValidationData()` function in the `SchemaUtilsType` was removed. Use the `validationDataMerge()` function
183+
instead. I.e.:
184+
185+
```ts
186+
import { toErrorList } from '@rjsf/utils';
187+
188+
const validationData: ValidationData = {
189+
errors: [
190+
/* Your validation errors go here */
191+
],
192+
errorSchema: {
193+
/* Your error schema goes here */
194+
},
195+
};
196+
197+
const additionalErrorSchema: ErrorSchema = {
198+
/* Your additional error schema goes here */
199+
};
200+
201+
const merged = validationDataMerge(validationData, additionalErrorSchema);
202+
```
120203

121204
#### ValidatorType.toErrorList()
122205

123-
Use the `@rjsf/utils` function `toErrorList()` instead
206+
The `toErrorList()` function on the `ValidatorType` interface was removed. Use the `toErrorList()` function from
207+
`@rjsf/utils` instead. I.e.:
208+
209+
```ts
210+
import { validationDataMerge, ErrorSchema, RJSFValidationError, toErrorList } from '@rjsf/utils';
211+
212+
const errorSchema: ErrorSchema = {
213+
/* Your error schema goes here */
214+
};
215+
216+
const validationErrors: RJSFValidationError[] = toErrorList(errorSchema);
217+
```
124218

125219
#### RJSF_ADDITONAL_PROPERTIES_FLAG
126220

127-
Use the `@rjsf/utils` constant `RJSF_ADDITIONAL_PROPERTIES_FLAG` instead.
221+
The constant `RJSF_ADDITONAL_PROPERTIES_FLAG` was removed from `@rjsf/utils`. Use the `RJSF_ADDITIONAL_PROPERTIES_FLAG`
222+
constant instead. I.e.:
223+
224+
```ts
225+
import { RJSF_ADDITIONAL_PROPERTIES_FLAG } from '@rjsf/utils';
226+
```
128227

129228
#### UiSchema.classNames
130229

131-
Use `ui:classNames` instead.
230+
The `classNames` notation on `UiSchema` was removed. Use the `ui:classNames` notation instead. I.e.:
231+
232+
```json
233+
{
234+
"someField": {
235+
"ui:classNames": "someCustomClass"
236+
}
237+
}
238+
```
132239

133240
#### schema.enumNames
134241

242+
The custom `enumNames` property support on a JSON Schema that RJSF invented has been removed. Please use the `UiSchema`
243+
replacement, `ui:enumNames` instead. I.e.:
244+
245+
```ts
246+
import { UiSchema, RJSFSchema } from '@rjsf/utils';
247+
248+
const schema: RJSFSchema = {
249+
type: 'object',
250+
properties: {
251+
attendance: {
252+
title: 'How did you attend the event?',
253+
enum: ['person', 'phone', 'video'],
254+
},
255+
rating: {
256+
title: 'How would you rate this event?',
257+
enum: ['0', '1', '2', '3', '4'],
258+
},
259+
},
260+
};
261+
262+
const uiSchema: UiSchema = {
263+
attendance: {
264+
'ui:enumNames': ['I joined in person', 'I called in using the phone number', 'I joined using the video link'],
265+
},
266+
rating: {
267+
'ui:enumNames': ["I did't like it", 'It was meh', 'It was ok', 'I liked it', 'I loved it'],
268+
},
269+
};
270+
```
271+
135272
Use the `ui:enumNames` in the `UiSchema` instead.
136273

137274
### Other BREAKING CHANGES

0 commit comments

Comments
 (0)