Questions are the backbone of your model. Make use of their properties to create complex objects.
Depending on their type their behavior changes. Read below about types before your start working with questions.
The values of a question are represented by outputs. All their possible values are called options. Have a look at the examples below to see how they interact with eachother.
questions:
string:
type: string
name: string
description: string
group: integer
order: integer
hidden: boolean
required: boolean
multiple: boolean
outputs: [ string, ... ]
inputs: [ string, ... ]
options: [ value, ... ]
default: [ value, ... ]
min: integer
max: integer
disable: boolean
...
| Key | Required | Type | Default | Description |
|---|---|---|---|---|
| type | Yes | String | - | Either list , table , boolean , text or datetime . |
| name | No | String | - | User-friendly name. |
| description | No | String | - | User-friendly description. |
| group | No | String | - | Bundle questions together with groups. |
| order | No | Integer | - | Set the order of a question. |
| hidden | No | Boolean | False | Whether It's hidden or not. |
| required | No | Boolean | False | Whether it's required or not. |
| multiple | No | Boolean | Depends on type | Whether this question can have multiple options assigned to it. |
| outputs | Yes | List of strings | Depends on type | The output names. |
| inputs | Yes | List of strings | Depends on type | The input names, should be included by the outputs. |
| options | Yes | List of values | Depends on type | The available options, should be corresponding to the outputs. |
| default | No | List of values | - | The default options. |
| min | No | Integer | - | Minimum value of the output. |
| max | No | Integer | - | Maximum value of the output. |
| disabled | No | boolean | - | Whether It's disabled or not. |
Types change the way how questions work. They make it easy to let it work in a certain reliable behavior.
A list is a set of options.
A list requires outputs and options. The first output is automatically set as input.
A table is a set of options with multiple inputs.
Tables work the same as lists, except they don't set the inputs automatically. They are useful for when you need to have multiple inputs.
A boolean is a true or false question.
Some keys are automatically created, so you don't have to write them. The outputs and inputs will only be value . And their options will be either true or false .
Initially a boolean will be null , unless you set the default. A boolean cannot have multiple set to true .
A text is an open question.
Some keys are automatically created, so you don't have to write them. The outputs and inputs will only be value . And the options will be empty.
A text cannot have multiple set to true .
A datetime is an ISO 8601 string.
Some keys are automatically created, so you don't have to write them. The outputs and inputs will only be value . And the options will be empty.
A text cannot have multiple set to true .
A radio button is a set of options.
A list requires outputs and options. The first output is automatically set as input.
A radiobutton cannot have multiple set to true .
The system checks if the output of the question is in numbers or letters with uppercase or lowercase letters by using a validation process that involves regular expressions.
In this example we are creating two simple lists:
frame_left
and
frame_right
.
They both have two outputs: id and price . And they both have two options with different prices.
questions:
frame_left:
type: list
outputs: [ id, price ]
options:
- [ variant_1, 100 ]
- [ variant_2, 200 ]
frame_right:
type: list
outputs: [ id, price ]
options:
- [ variant_1, 100 ]
- [ variant_2, 200 ]
In this example we are creating a table for dimensions. We have entered a name and description for readability.
We have created 4 outputs: width, height, warranty and price. The inputs will be just width and height.
With
required
we indicate that this question cannot be empty.
In order for that to work, we have also set the
default
value.
questions:
dimensions:
type: table
name: "Dimensions"
description: "Custom dimensions including warranty and price."
required: true
outputs: [ width, height, warranty, price ]
inputs: [ width, height ]
options:
- [ 1400, 800, true, 800 ]
- [ 1400, 820, true, 820 ]
- [ 1400, 840, true, 840 ]
- [ 1400, 860, false, 860 ]
- [ 1500, 800, true, 900 ]
- [ 1500, 820, true, 920 ]
- [ 1500, 840, true, 940 ]
- [ 1500, 860, false, 960 ]
- [ 2000, 800, true, 1000 ]
- [ 2000, 820, true, 1020 ]
- [ 2000, 840, true, 1040 ]
- [ 2000, 860, false, 1060 ]
default:
- [ 1400, 800 ]
In this example we will show you how to make multiple selections. We have entered name and description for readability.
We have configured a simple list with multiple
outputs
.
Because the
inputs
are not specified, it will automatically be the first output.
We have set
multiple
to true.
And now we can set multiple
default
values.
questions:
accessories:
type: list
name: "Accessories"
description: "Couch accessories."
multiple: true
outputs: [ id, name, price ]
options:
- [ blanket, "Soft blanket", 60 ]
- [ pillow, "Round pillow", 10 ]
- [ cleaner, "Cleaning solution", 9.99 ]
default:
- [ pillow ]
- [ cleaner ]