Skip to content

Commit 11b019e

Browse files
committed
Add validate method on renderer.FormInstance
1 parent d348456 commit 11b019e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/renderer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import ReactDOM from 'react-dom';
33
import EditorState from './editorState';
44
import ReactJSONForm from './form';
5+
import DataValidator from './dataValidation';
56

67

78
export function FormInstance(config) {
@@ -78,6 +79,11 @@ export function FormInstance(config) {
7879
this.getData = function() {
7980
return this.data;
8081
};
82+
83+
this.validate = function() {
84+
let validator = new DataValidator(this.getSchema());
85+
return validator.validate(this.getData());
86+
};
8187
}
8288

8389

0 commit comments

Comments
 (0)