Skip to content

Commit 8464554

Browse files
authored
feat: fileUrl as string editor type (#509)
We want to add file upload to the input schema, decided to go with url on the input. Seems like a good idea to just use a special editor for this, instead of adding a new input type. The default fallback editor should work reasonably well everywhere. ### Related PRs: - apify/apify-docs#1524
1 parent da7166a commit 8464554

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/input_schema/src/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"title": { "type": "string" },
8989
"description": { "type": "string" },
9090
"nullable": { "type": "boolean" },
91-
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "hidden"] },
91+
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "datepicker", "hidden", "fileupload"] },
9292
"isSecret": { "type": "boolean" }
9393
},
9494
"required": ["type", "title", "description", "editor"],
@@ -139,7 +139,7 @@
139139
"nullable": { "type": "boolean" },
140140
"minLength": { "type": "integer" },
141141
"maxLength": { "type": "integer" },
142-
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "hidden"] },
142+
"editor": { "enum": ["javascript", "python", "textfield", "textarea", "hidden", "fileupload"] },
143143
"isSecret": { "enum": [false] },
144144
"sectionCaption": { "type": "string" },
145145
"sectionDescription": { "type": "string" }

packages/input_schema/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type CommonFieldDefinition<T> = {
1111

1212
export type StringFieldDefinition = CommonFieldDefinition<string> & {
1313
type: 'string'
14-
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json';
14+
editor: 'textfield' | 'textarea' | 'javascript' | 'python' | 'select' | 'datepicker' | 'hidden' | 'json' | 'fileupload';
1515
pattern?: string;
1616
minLength?: number;
1717
maxLength?: number;

test/input_schema.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ describe('input_schema.json', () => {
3333
enum: ['a', 'b', 'c'],
3434
enumTitles: ['A', 'B', 'C'],
3535
},
36+
myField4: {
37+
title: 'Field title',
38+
type: 'string',
39+
description: 'Some description ...',
40+
editor: 'fileupload',
41+
},
3642
},
3743
};
3844

@@ -157,7 +163,7 @@ describe('input_schema.json', () => {
157163

158164
expect(() => validateInputSchema(validator, schema)).toThrow(
159165
'Input schema is not valid (Field schema.properties.myField.editor must be equal to one of the allowed values: '
160-
+ '"javascript", "python", "textfield", "textarea", "hidden")',
166+
+ '"javascript", "python", "textfield", "textarea", "hidden", "fileupload")',
161167
);
162168
});
163169

0 commit comments

Comments
 (0)