Created
January 9, 2019 18:16
-
-
Save mediawrangler/2f5e97c6ae66c37501b6f1dd0d113b5d to your computer and use it in GitHub Desktop.
React JSON Schema Form - Conditionals (Schema Dependency)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "A registration form", | |
"description": "A simple form example.", | |
"type": "object", | |
"properties": { | |
"hasMiddleName": { | |
"type": "boolean", | |
"title": "Has Middle Name?" | |
}, | |
"lastName": { | |
"type": "string", | |
"title": "Last Name", | |
"default": "Lynch" | |
}, | |
"firstName": { | |
"type": "string", | |
"title": "First Name", | |
"default": "Travis" | |
} | |
}, | |
"dependencies": { | |
"hasMiddleName": { | |
"oneOf": [ | |
{ | |
"properties": { | |
"hasMiddleName": { | |
"enum": [ | |
true | |
] | |
}, | |
"middleName": { | |
"type": "string", | |
"title": "Middle Name" | |
} | |
} | |
}, | |
{ | |
"properties": { | |
"hasMiddleName": { | |
"enum": [ | |
false | |
] | |
} | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment