Skip to content

Commit a9726fa

Browse files
authored
feat: add fileupload editor for string arrays (#545)
This PR allows the use of the `fileupload` input for an array of strings. Instead of re-using the `arrayItemsStringlist` reference, I've added `arrayItemsFileupload` with the same shape. It will work the same way as it currently works for a single string. Related PR in console: apify/apify-core#23289 The order of PRs does not matter: The UI will fallback to code input, and the input just won't do anything until it encounters the editor in schema.
1 parent 2506905 commit a9726fa

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

packages/json_schemas/schemas/input.schema.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
"type": "object",
180180
"properties": {
181181
"type": { "enum": ["array"] },
182-
"editor": { "enum": ["json", "requestListSources", "pseudoUrls", "globs", "keyValue", "stringList", "select", "schemaBased", "hidden"] },
182+
"editor": { "enum": ["json", "requestListSources", "pseudoUrls", "globs", "keyValue", "stringList", "fileupload", "select", "schemaBased", "hidden"] },
183183
"isSecret": { "type": "boolean" }
184184
},
185185
"required": ["type", "title", "description", "editor"],
@@ -225,6 +225,13 @@
225225
"items": { "$ref": "#/definitions/arrayItemsKeyValue" }
226226
}
227227
},
228+
{
229+
"required": ["editor"],
230+
"properties": {
231+
"editor": { "enum": ["fileupload"] },
232+
"items": { "$ref": "#/definitions/arrayItemsFileupload" }
233+
}
234+
},
228235
{
229236
"required": ["editor"],
230237
"properties": {
@@ -679,7 +686,7 @@
679686
"type": "object",
680687
"properties": {
681688
"type": { "enum": ["array"] },
682-
"editor": { "enum": ["json", "requestListSources", "pseudoUrls", "globs", "keyValue", "stringList", "select", "hidden"] },
689+
"editor": { "enum": ["json", "requestListSources", "pseudoUrls", "globs", "keyValue", "stringList", "fileupload", "select", "hidden"] },
683690
"title": { "type": "string" },
684691
"description": { "type": "string" },
685692
"nullable": { "type": "boolean" },
@@ -708,6 +715,13 @@
708715
"items": { "$ref": "#/definitions/arrayItemsKeyValue" }
709716
}
710717
},
718+
{
719+
"required": ["editor"],
720+
"properties": {
721+
"editor": { "enum": ["fileupload"] },
722+
"items": { "$ref": "#/definitions/arrayItemsFileupload" }
723+
}
724+
},
711725
{
712726
"required": ["editor"],
713727
"properties": {
@@ -1007,6 +1021,18 @@
10071021
},
10081022
"required": ["type"]
10091023
},
1024+
"arrayItemsFileupload": {
1025+
"title": "Utils: Array items fileupload definition",
1026+
"type": "object",
1027+
"additionalProperties": false,
1028+
"properties": {
1029+
"type": { "enum": ["string"] },
1030+
"pattern": { "type": "string" },
1031+
"minLength": { "type": "integer" },
1032+
"maxLength": { "type": "integer" }
1033+
},
1034+
"required": ["type"]
1035+
},
10101036
"arrayItemsGlobs": {
10111037
"title": "Utils: Array items globs definition",
10121038
"type": "object",

test/input_schema.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ describe('input_schema.json', () => {
3939
description: 'Some description ...',
4040
editor: 'fileupload',
4141
},
42+
myfield5: {
43+
title: 'Array fileupload title',
44+
type: 'array',
45+
description: 'Some description...',
46+
editor: 'fileupload',
47+
},
4248
},
4349
};
4450

0 commit comments

Comments
 (0)