angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
93 lines (92 loc) • 2.11 kB
JSON
{
"schema": {
"type": "object",
"properties": {
"select": {
"title": "Select without titleMap",
"type": "string",
"enum": [ "a", "b", "c" ]
},
"select2": {
"title": "Select with titleMap (old style)",
"type": "string",
"enum": [ "a", "b", "c" ]
},
"noenum": {
"type": "string",
"title": "No enum, but forms says it's a select"
},
"array": {
"title": "Array with enum defaults to 'checkboxes'",
"type": "array",
"items": {
"type": "string",
"enum": [ "a", "b", "c" ]
}
},
"array2": {
"title": "Array with titleMap",
"type": "array",
"default": [ "b", "c" ],
"items": {
"type": "string",
"enum": [ "a", "b", "c" ]
}
},
"radios": {
"title": "Basic radio button example",
"type": "string",
"enum": [ "a", "b", "c" ]
},
"radiobuttons": {
"title": "Radio buttons used to switch a boolean",
"type": "boolean",
"default": false
}
}
},
"form": [
"select",
{
"key": "select2",
"type": "select",
"titleMap": { "a": "A", "b": "B", "c": "C" }
},
{
"key": "noenum",
"type": "select",
"titleMap": [
{ "value": "a", "name": "A" },
{ "value": "b", "name": "B" },
{ "value": "c", "name": "C" }
]
},
"array",
{
"key": "array2",
"type": "checkboxes",
"titleMap": [
{ "value": "a", "name": "A" },
{ "value": "b", "name": "B" },
{ "value": "c", "name": "C" }
]
},
{
"key": "radios",
"type": "radios",
"titleMap": [
{ "value": "c", "name": "C" },
{ "value": "b", "name": "B" },
{ "value": "a", "name": "A" }
]
},
{
"key": "radiobuttons",
"type": "radiobuttons",
"titleMap": [
{ "value": false, "name": "No way" },
{ "value": true, "name": "OK" }
]
}
]
}