Settings
Defines the settings that will be exposed to being configured by the user and is more associated to the point of view of business, behavior or user interface.
The setup.json
file uses the JSON Schema format to define settings schema. That schema must have default values in all the settings values required by the module.
{
"settings": {
"schema": {
"properties": {}
}
}
}
General Attributes
All field types accept the following attributes:
type
: Declares the type of the setting field. It can contain these values:
- string
- boolean
- integer
- number
- array
- object
title
: A text label to accompany the setting field. (e.g. “Initial dates”)
description
: A longer description of the setting field. (e.g. “Initial
dates pre populated by default…“)
default
The default value to be used for the setting field.
Keep in mind the default value must be of the type
specified by the field. So for example, the default
for an array
of string
type would be ["Item one", "Item two"]
.
help
: Useful indications related to the field (e.g. “'Ctrl + click' to select more than one.”)
{
"settings": {
"schema": {
"properties": {
"some-property": {
"type": "string",
"title": "Title",
"description": ""
}
}
}
}
}
Primitive types
String
string: Presented as a text input
maxLength
: String types accept a maxLength property which defines the maximum number of characters the field should allow.
placeholder
: String types allow you to specify the placeholder value which will appear as lighter-than-normal text in the input when it is empty. This is a useful place to include an example of how a value to be placed in that field should look.
{
"title": "Some simple title",
"type": "string",
"default": "Some default value"
}
Long string
string/textarea: Presented as a text input with validation to ensure the customer provides an email address. The default placeholder can be overridden.
{
"title": "Textarea Example",
"type": "string",
"format": "textarea",
"default": "When the Internet first came, I thought it was just the beacon of freedom. People could communicate with anyone, anywhere, and nobody could stop it.\n\n-Steve Wozniak"
}
URL String
string/url: Presented as a text input with validation to ensure the customer provides a URL. The default placeholder can be overridden.
{
"title": "URL String Example",
"type": "string",
"format": "url"
}
Email String
string/email: Presented as a text input with validation to ensure the customer provides an email address. The default placeholder can be overridden.
{
"title": "Email String Example",
"type": "string",
"format": "email"
}
Date
string/date: Presented to the customer with a date picker. The resulting date value is provided to the app in a format understood by new Date.
{
"title": "Date Example",
"type": "string",
"format": "date",
"default": "2015-10-10"
}
Integer number
integer: Presented as a number-style text input which only accepts an integer.
Both integers and floating-point numbers can set a minimum
and maximum
value.
{
"title": "Integer Example",
"description": "Input a number between 5 and 50.",
"type": "integer",
"default": 5,
"minimum": 5,
"maximum": 50
}
{
"default": 0.5,
"title": "Number Example",
"type": "number"
}