apify / apify-sdk-js

Apify SDK monorepo
https://docs.apify.com/sdk/js
Apache License 2.0
123 stars 35 forks source link

Support input schema defaults in `Actor.getInput()` #287

Open B4nan opened 8 months ago

B4nan commented 8 months ago

Currently, the input schema is ignored locally, and to respect the defaults inside it, you need to use the Apify CLI to run the actor, which creates the INPUT.json file based on those defaults when missing.

Implement input schema support on the SDK level, so this works on the fly if the INPUT.json file is missing. If it's there, we should still fill in the missing fields that have defaults in the input schema.

The goal of this PR is to unify the local vs platform behavior. As a nice side effect, there shouldn't be any need to use the Apify CLI to run the actor, as npm start should behave the same with this implemented.

mtrunkat commented 8 months ago

Defaults and prefil, no? In fact, I am not sure, let's discuss that on Slack.

B4nan commented 8 months ago

The idea is to align behavior with the platform without the need for apify run, I am never sure about default vs prefill :]