Skip to content

Commit

Permalink
Refine match schema, particularly vars definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmarkow committed Oct 13, 2023
1 parent 25df408 commit 31ce2eb
Showing 1 changed file with 64 additions and 67 deletions.
131 changes: 64 additions & 67 deletions schemas/Espanso_Match_Schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,102 +56,99 @@
"type": "boolean",
"default": "false"
},
"global_vars": {
"type": "array",
"global_vars":{
"type":"array",
"globalvarItems": {
"$ref": "#/vars/varItems"
"$ref":"#/vars/varItems"
}
},
"form_fields": {
"form_fields":{
"description": "Please prefix all form field names with FF_, in order for them to be properly validated against schema.",
"type": "object",
"patternProperties": {
"type":"object",
"patternProperties": {
"^FF_": {
"type": "object",
"properties": {
"type": {
"type": "string",
"type":{
"type":"string",
"description": "What type of form element will be rendered when this form field is used. See https://espanso.org/docs/matches/forms/#controls.",
"enum": [
"choice",
"list",
"form"
]
},
"multiline": {
"type": "boolean",
"default": "false"
"multiline":{
"type":"boolean",
"default":"false"
},
"default": {
"type": "string",
"default":{
"type":"string",
"description": "Optional data that specifies the default value of the specific form field. See https://espanso.org/docs/matches/forms/#text-fields"
},
"trim_string_values": {
"type": "boolean",
"default": "true",
"trim_string_values":{
"type":"boolean",
"default":"true",
"description": "If you pass the values as a multiline string and this option is true, Espanso will trim the values and remove empty ones. If you choose this option, use the | pipe character after you type the values key and colon."
},
"values": {
"values":{
"description": "The list of values to choose from. This can be either a multiline string or an array of strings. See https://espanso.org/docs/matches/forms/#list-box",
"type": [
"array",
"string"
],
"minItems": 1
"type":["array","string"],
"minItems":1
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "list"
{
"if": {
"properties": {
"type": {
"const": "list"
}
}
},
"then": {
"not": {
"required": [
"multiline"
]
}
}
}
},
"then": {
"not": {
"required": [
"multiline"
]
}
}
},
{
"if": {
"properties": {
"type": {
"const": "choice"
},
{
"if": {
"properties": {
"type": {
"const": "choice"
}
}
},
"then": {
"not": {
"required": [
"multiline"
]
}
}
}
},
"then": {
"not": {
"required": [
"multiline"
]
}
}
},
{
"if": {
"properties": {
"type": {
"const": "form"
},
{
"if": {
"properties": {
"type": {
"const": "form"
}
}
},
"then": {
"not": {
"required": [
"values"
]
}
}
}
},
"then": {
"not": {
"required": [
"values"
]
}
}
}
]
}
}
}
},
"vars": {
"type": "array",
Expand Down

0 comments on commit 31ce2eb

Please sign in to comment.