Skip to content

Commit 0b66337

Browse files
committed
Fix example app with rjsf version 5.x.x
1 parent 952ece2 commit 0b66337

File tree

4 files changed

+144
-16
lines changed

4 files changed

+144
-16
lines changed

example/components/JsonSchemaFormSuite.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from 'reactstrap';
1010
import { withTheme } from '@rjsf/core';
1111
import { Theme as Bootstrap4Theme } from '@rjsf/bootstrap-4';
12+
import validator from '@rjsf/validator-ajv8';
1213
import {
1314
FormBuilder,
1415
PredefinedGallery,
@@ -42,18 +43,7 @@ type State = {
4243
submissionData: any;
4344
};
4445

45-
interface FormProps {
46-
schema: { [key: string]: any };
47-
uiSchema: { [key: string]: any };
48-
onChange: (_arg0: { [key: string]: any }) => void;
49-
formData: { [key: string]: any };
50-
submitButtonMessage: string;
51-
onSubmit: (_arg0: { [key: string]: any }) => void;
52-
}
53-
54-
const Form = withTheme(
55-
Bootstrap4Theme,
56-
) as unknown as FunctionComponent<FormProps>;
46+
const Form = withTheme(Bootstrap4Theme);
5747

5848
// return error message for parsing or blank if no error
5949
function checkError(text: string) {
@@ -188,7 +178,8 @@ class JsonSchemaFormEditor extends React.Component<Props, State> {
188178
this.updateFormData(JSON.stringify(formData.formData))
189179
}
190180
formData={this.state.formData}
191-
submitButtonMessage={'Submit'}
181+
validator={validator}
182+
liveValidate
192183
onSubmit={(submissionData) => {
193184
// below only runs if validation succeeded
194185
this.setState({
@@ -211,7 +202,11 @@ class JsonSchemaFormEditor extends React.Component<Props, State> {
211202
<pre
212203
className={this.props?.classes?.codeViewer ?? ''}
213204
>
214-
{JSON.stringify(this.state.submissionData, null, 2)}
205+
{JSON.stringify(
206+
this.state.submissionData.formData,
207+
null,
208+
2,
209+
)}
215210
</pre>
216211
</ErrorBoundary>
217212
<br />

example/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

example/package-lock.json

Lines changed: 132 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
},
1717
"dependencies": {
1818
"@ginkgo-bioworks/react-json-schema-form-builder": "file:..",
19-
"@rjsf/core": "^5.24.3",
2019
"@rjsf/bootstrap-4": "^5.24.3",
20+
"@rjsf/core": "^5.24.3",
21+
"@rjsf/validator-ajv8": "^5.24.3",
2122
"react-bootstrap": "^1.6.4",
2223
"react-json-editor-ajrm": "^2.5.14"
2324
},

0 commit comments

Comments
 (0)