Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add resourceType property to support storage picker #1261

Merged
merged 6 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,41 @@ Editor type `select` allows the user to pick items from a select, providing mult
```

To correctly define options for multiselect, you need to define the `items` property and then provide values and (optionally) labels in `enum` and `enumTitles` properties.

### Resource type

Resource type identifies what kind of object is referred to in the input field. For example, the Key-value store resource type can be referred to using a string ID.
MFori marked this conversation as resolved.
Show resolved Hide resolved
Currently, it supports storage resources only, allowing the reference of a Dataset, Key-Value Store or Request Queue.

For Actor developers, the resource input value is a string representing the storage ID.
The type of the property is either `string` or `array`. In case of `array` (for multiple resources) the return value is an array of IDs.
In the user interface, a picker is provided for easy selection, where users can search and choose from their own storages or those they have access to.

Example of a Dataset input:

```json
{
"title": "Dataset",
"type": "string",
"description": "Select a dataset",
"resourceType": "dataset"
}
```

Rendered input:

![Apify Actor input schema dataset](./images/input-schema-dataset.png)

The returned value is resource reference, in this example it's the dataset ID as can be seen in the JSON tab:

![Apify Actor input schema dataset](./images/input-schema-dataset-json.png)

Properties:

| Property | Value | Required | Description |
|----------------|-----------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------|
| `type` | One of <ul><li>`string`</li><li>`array`</li></ul> | Yes | Specifies the type of input - string for single value or array for multiple values |
| `editor` | One of <ul><li>`resourcePicker`</li><li>`hidden`</li></ul> | No | Visual editor used for <br/>the input field. Defaults to `resourcePicker`. |
| `resourceType` | One of <ul><li>`dataset`</li><li>`keyValueStore`</li><li>`requestQueue`</li></ul> | Yes | Type of resource |
MFori marked this conversation as resolved.
Show resolved Hide resolved
| `minItems` | Integer | No | Minimum number of items the array can contain. Only for `type: array` |
| `maxItems` | Integer | No | Maximum number of items the array can contain. Only for `type: array` |