Skip to content

Commit 2af6ae4

Browse files
committed
Documentation updates
1 parent f6f4f3e commit 2af6ae4

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

docs/4.x upgrade guide.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 4.x Upgrade Guide
2+
3+
## Breaking changes
4+
5+
### Breaking changes due to Ajv v7
6+
7+
The following is a list of changes due to Ajv update to v7.
8+
9+
#### JSON Schema draft-04
10+
11+
This version drops support for JSON schema draft-04.
12+
You can update your schema to the specs of draft-07 using [ajv-cli](https://www.npmjs.com/package/ajv-cli).
13+
14+
#### Object property name restrictions
15+
16+
The following characters may cause unexpected behavior when used in property names:
17+
- /
18+
- [
19+
- ]
20+
21+
If you are using any of these in your property names, you should change them or continue using 3.x until EOL.
22+
23+
## New
24+
25+
### Schema warnings
26+
27+
If your schema does not pass the strict types check, you will see warnings printed to stderr/console. Your form will work as expected even with the warnings. You should aim to fix the schema to avoid the warnings as these schemas will not be accepted in the next major version.

docs/api-reference/form-props.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Note that this just renders the `action` attribute in the HTML markup. There is
1212

1313
## additionalMetaSchemas
1414

15-
This prop allows you to validate the form data against another JSON Schema meta schema, for example, JSON Schema draft-04. See [Validation](../usage/validation.md) for more information.
15+
This prop allows you to validate the form data against another JSON Schema meta schema, for example, JSON Schema draft-06. See [Validation](../usage/validation.md) for more information.
1616

1717
## ArrayFieldTemplate
1818

docs/usage/validation.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ To have your schemas validated against any other meta schema than draft-07 (the
177177

178178
```json
179179
{
180-
"$schema": "http://json-schema.org/draft-04/schema#",
180+
"$schema": "http://json-schema.org/draft-06/schema#",
181181
...
182182
}
183183
```
@@ -186,22 +186,22 @@ Note that react-jsonschema-form only supports the latest version of JSON Schema,
186186

187187
### additionalMetaSchemas
188188

189-
The `additionalMetaSchemas` prop allows you to validate the form data against one (or more than one) JSON Schema meta schema, for example, JSON Schema draft-04. You can import a meta schema as follows:
189+
The `additionalMetaSchemas` prop allows you to validate the form data against one (or more than one) JSON Schema meta schema, for example, JSON Schema draft-06. You can import a meta schema as follows:
190190

191191
```jsx
192-
const metaSchemaDraft04 = require("ajv/lib/refs/json-schema-draft-04.json");
192+
const metaSchemaDraft06 = require("ajv/lib/refs/json-schema-draft-06.json");
193193
```
194194

195-
In this example `schema` passed as props to `Form` component can be validated against draft-07 (default) and by draft-04 (added), depending on the value of `$schema` attribute.
195+
In this example `schema` passed as props to `Form` component can be validated against draft-07 (default) and by draft-06 (added), depending on the value of `$schema` attribute.
196196

197197
```jsx
198198
const schema = {
199-
"$schema": "http://json-schema.org/draft-04/schema#",
199+
"$schema": "http://json-schema.org/draft-06/schema#",
200200
type: "string"
201201
};
202202

203203
return (<Form schema={schema}
204-
additionalMetaSchemas={[metaSchemaDraft04]} />);
204+
additionalMetaSchemas={[metaSchemaDraft06]} />);
205205
```
206206

207207
## customFormats

0 commit comments

Comments
 (0)