Skip to content

Commit 8467240

Browse files
committed
better description and example of input rendering
1 parent ab0126c commit 8467240

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed
93.4 KB
Loading
40.1 KB
Loading
24.8 KB
Loading

sources/platform/actors/development/actor_definition/input_schema/specification.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,20 +181,60 @@ Rendered input:
181181

182182
![Apify Actor input schema - country input](./images/input-schema-country.png)
183183

184+
Example of date selection using absolute and relative `datepicker` editor:
185+
186+
```json
187+
{
188+
"absolute_date": {
189+
"title": "Date",
190+
"type": "string",
191+
"description": "Select date",
192+
"editor": "datepicker"
193+
},
194+
"relative_date": {
195+
"title": "Relative date",
196+
"type": "string",
197+
"description": "Select date",
198+
"editor": "datepicker",
199+
"allowAbsolute": false,
200+
"allowRelative": true
201+
},
202+
"any_date": {
203+
"title": "Any date",
204+
"type": "string",
205+
"description": "Select date",
206+
"editor": "datepicker",
207+
"allowRelative": true
208+
}
209+
}
210+
```
211+
212+
Rendered input for `absolute_date` property. See that by default, the date picker allows selecting only an absolute date in the form `YYYY-MM-DD`:
213+
214+
![Apify Actor input schema - country input](./images/input-schema-date-absolute.png)
215+
216+
Rendered input for `relative_date` property in form of `+/- {number} {unit}`. (The `allowAbsolute` is explicitly set to `false`):
217+
218+
![Apify Actor input schema - country input](./images/input-schema-date-relative.png)
219+
220+
Rendered input for `any_date` property. The date picker allows selecting both absolute and relative dates, and it's up to the Actor author to parse recognize the chosen form:
221+
222+
![Apify Actor input schema - country input](./images/input-schema-date-both.png)
223+
184224
Properties:
185225

186-
| Property | Value | Required | Description |
187-
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
188-
| `editor` | One of <ul><li>`textfield`</li><li>`textarea`</li><li>`javascript`</li><li>`python`</li><li>`select`</li><li>`datepicker`</li><li>`hidden`</li></ul> | Yes | Visual editor used for <br/>the input field. |
189-
| `pattern` | String | No | Regular expression that will be <br/>used to validate the input. <br/> If validation fails, <br/>the Actor will not run. |
190-
| `minLength` | Integer | No | Minimum length of the string. |
191-
| `maxLength` | Integer | No | Maximum length of the string. |
192-
| `enum` | [String] | Required if <br/>`editor` <br/>is `select` | Using this field, you can limit values <br/>to the given array of strings. <br/>Input will be displayed as select box. |
193-
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
194-
| `nullable` | Boolean | No | Specifies whether `null` <br/>is an allowed value. |
195-
| `isSecret` | Boolean | No | Specifies whether the input field<br />will be stored encrypted.<br />Only available <br />with `textfield` and `textarea` editors. |
196-
| `allowAbsolute` | Boolean | No | Used only with `datepicker` editor for absolute date value picker in form `YYYY-MM-DD`. This defaults to `true`. |
197-
| `allowRelative` | Boolean | No | Used only with `datepicker` editor for relative input in form `+/- {number} {unit}` e.g. `+ 3 weeks`. Supported units are: days, weeks, months and years.<br/>If only relative input is required, `allowAbsolute` needs to be explicitly set to `false`, otherwise both formats are supported. |
226+
| Property | Value | Required | Description |
227+
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
228+
| `editor` | One of <ul><li>`textfield`</li><li>`textarea`</li><li>`javascript`</li><li>`python`</li><li>`select`</li><li>`datepicker`</li><li>`hidden`</li></ul> | Yes | Visual editor used for <br/>the input field. |
229+
| `pattern` | String | No | Regular expression that will be <br/>used to validate the input. <br/> If validation fails, <br/>the Actor will not run. |
230+
| `minLength` | Integer | No | Minimum length of the string. |
231+
| `maxLength` | Integer | No | Maximum length of the string. |
232+
| `enum` | [String] | Required if <br/>`editor` <br/>is `select` | Using this field, you can limit values <br/>to the given array of strings. <br/>Input will be displayed as select box. |
233+
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
234+
| `nullable` | Boolean | No | Specifies whether `null` <br/>is an allowed value. |
235+
| `isSecret` | Boolean | No | Specifies whether the input field<br />will be stored encrypted.<br />Only available <br />with `textfield` and `textarea` editors. |
236+
| `allowAbsolute` | Boolean | No | Used only with `datepicker` editor for absolute date value picker in form `YYYY-MM-DD`. This defaults to `true`. |
237+
| `allowRelative` | Boolean | No | Used only with `datepicker` editor for relative input in form `+/- {number} {unit}`.<br/>The value passed to Actor input is in plain text e.g. `"+ 3 weeks"` and it's up to Actor author to parse it.<br/>Supported units are: days, weeks, months and years.<br/>If only relative input is required, `allowAbsolute` needs to be explicitly set to `false`, otherwise both formats are supported. |
198238

199239
:::note Regex escape
200240

0 commit comments

Comments
 (0)