Skip to content

Commit

Permalink
improve examples
Browse files Browse the repository at this point in the history
  • Loading branch information
picodoth committed Jun 1, 2018
1 parent 8872e55 commit 4f3274d
Showing 1 changed file with 60 additions and 44 deletions.
104 changes: 60 additions & 44 deletions playground/samples/anyOf.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,71 @@
module.exports = {
schema: {
"title": "Any of",
"type": "object",
"properties": {
"List of widgets": {
"type": "array",
"items": {
"anyOf": [
{
"title": "string",
"type": "string",
"default": ""
type: 'object',
definitions: {
option: {
type: 'object',
required: ['label', 'value'],
properties: {
label: {
type: 'string',
},
value: {
type: 'string',
},
},
default: { label: '', value: '' }
},
optGroup: {
type: 'object',
required: ['label', 'items'],
properties: {
label: {
type: 'string',
},
items: {
type: 'array',
items: {
$ref: '#/definitions/option',
},
},
},
default: {
label: '',
items: [],
},
},
},
properties: {
options: {
type: 'array',
title: 'Options',
items: {
anyOf: [
{
"title": "integer",
"type": "integer",
"default": 0
$ref: '#/definitions/option',
title: 'option',
},
{
"title": "array",
"type": "array",
"items": {
"anyOf": [
{
"title": "string",
"type": "string",
"default": ""
},
{
"title": "integer",
"type": "integer",
"default": 0
}
]
},
"default": [""],
}
]
}
}
}
$ref: '#/definitions/optGroup',
title: 'optGroup',
},
],
},
},
},
},
uiSchema: {},
formData: {
"List of widgets": [
27,
"Batman",
[
"Bruce",
"Wayne"
]
options: [
{ label: 'car', value: 'car' },
{ label: 'house', value: 'house' },
{
label: 'fruit',
items: [
{ label: 'apple', value: 'apple' },
{ label: 'banana', value: 'banana' },
],
},
]
}
},
};

0 comments on commit 4f3274d

Please sign in to comment.