Skip to content

Commit 9ed3f3d

Browse files
committed
Fix #91: Account for refs on top level
1 parent 8c19c52 commit 9ed3f3d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/form.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export default class ReactJSONForm extends React.Component {
3636
let schema = this.props.editorState.getSchema();
3737
let formGroups = [];
3838

39+
if (schema.hasOwnProperty('$ref')) {
40+
schema = {...this.getRef(schema['$ref']), ...schema};
41+
delete schema['$ref'];
42+
}
43+
3944
let type = getSchemaType(schema);
4045

4146
let args = {

src/schemaValidation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export function validateSchema(schema) {
1919
validation = validateOneOf(schema);
2020
} else if (schema.hasOwnProperty('anyOf')) {
2121
validation = validateAnyOf(schema);
22+
} else if (schema.hasOwnProperty('$ref')) {
23+
validation = {isValid: true};
2224
} else {
2325
validation = {
2426
isValid: false,

0 commit comments

Comments
 (0)