Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/input_schema/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type StringFieldDefinition = CommonFieldDefinition<string> & {
minLength?: number;
maxLength?: number;
enum?: readonly string[]; // required if editor is 'select'
enumTitles?: readonly string[]
enumTitles?: readonly string[];
enumSuggestedValues?: readonly string[];
isSecret?: boolean;
// Used for 'datepicker' editor, absolute is considered as default value
dateType?: 'absolute' | 'relative' | 'absoluteOrRelative';
Expand Down
73 changes: 63 additions & 10 deletions packages/json_schemas/schemas/input.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,13 @@
"title": { "type": "string" },
"description": { "type": "string" },
"nullable": { "type": "boolean" },
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "fileupload"] },
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "select", "fileupload", "hidden"] },
"isSecret": { "type": "boolean" }
},
"required": ["type", "title", "description", "editor"],
"if": {
"properties": {
"isSecret": {
"not": {
"const": true
}
}
"isSecret": { "not": { "const": true } }
}
},
"then": {
Expand Down Expand Up @@ -142,7 +138,7 @@
},
"else": {
"properties": {
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "hidden", "fileupload"] }
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "select", "fileupload", "hidden"] }
}
}
},
Expand All @@ -156,6 +152,30 @@
"else": {
"properties": { "default": { "type": ["string", "null"] } }
}
},
{
"if": {
"required": ["editor"],
"properties": {
"editor": { "const": "select" }
}
},
"then": {
"properties": {
"enumSuggestedValues": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
},
"enumTitles": {
"type": "array",
"items": { "type": "string" },
"minItems": 1
}
},
"required": ["enumSuggestedValues"]
}
}
]
},
Expand Down Expand Up @@ -694,7 +714,7 @@
"nullable": { "type": "boolean" },
"minLength": { "type": "integer" },
"maxLength": { "type": "integer" },
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "fileupload"] }
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "select", "fileupload", "hidden"] }
},
"required": ["type", "title", "description"],
"allOf": [
Expand All @@ -712,7 +732,7 @@
},
"else": {
"properties": {
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "hidden", "fileupload"] }
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "select", "fileupload", "hidden"] }
}
}
},
Expand All @@ -726,6 +746,30 @@
"else": {
"properties": { "default": { "type": ["string", "null"] } }
}
},
{
"if": {
"required": ["editor"],
"properties": {
"editor": { "const": "select" }
}
},
"then": {
"properties": {
"enumSuggestedValues": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
},
"enumTitles": {
"type": "array",
"items": { "type": "string" },
"minItems": 1
}
},
"required": ["enumSuggestedValues"]
}
}
]
},
Expand Down Expand Up @@ -1137,9 +1181,18 @@
"enumTitles": {
"type": "array",
"items": { "type": "string" }
},
"enumSuggestedValues": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
}
},
"required": ["type", "enum"]
"oneOf": [
{ "required": ["type", "enum"] },
{ "required": ["type", "enumSuggestedValues"] }
]
},
"arrayItemsKeyValue": {
"title": "Utils: Array items keyValue definition",
Expand Down
Loading