Skip to content

feat: respect input schema defaults in Actor.getInput()#409

Merged
B4nan merged 8 commits into
masterfrom
feat/prefills-in-getInput
Oct 6, 2025
Merged

feat: respect input schema defaults in Actor.getInput()#409
B4nan merged 8 commits into
masterfrom
feat/prefills-in-getInput

Conversation

@vladfrangu

Copy link
Copy Markdown
Member

Way too overdue, closes #287

@github-actions github-actions Bot added this to the 118th sprint - Tooling team milestone Jul 6, 2025
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Jul 6, 2025
@B4nan B4nan requested review from B4nan and barjin July 28, 2025 09:32

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nits, but looks alright to me otherwise, thank you!

Comment thread packages/apify/src/input-schemas.ts Outdated

export const readInputSchema = (): Dictionary | null => {
const localConfig = readJSONIfExists(
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.cwd() will likely break if the Dockerfile entry point is not npm (--prefix=app/) start, but e.g. node app/main.js

But I'm not sure how else we would refer to these files 🤔 I guess it's okay to live with this, especially since on Platform, we load this via API.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only gave it a quick look, but it looks like we don't copy the .actor directory in our Dockerfiles anyway, so for the "build a Docker image and run it outside of the platform" use case, the answer to "But I'm not sure how else we would refer to these files" is probably "tough luck lol" 🤷

But if we add a nice error log when there's not input schema to be found, yeah, we can live with that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean outside process.cwd, we have no way of finding these files... Maybe if we just walk up from process.cwd but I would rather... not :D

Comment thread packages/apify/src/actor.ts Outdated
Comment thread packages/apify/src/actor.ts Outdated

export const readInputSchema = (): Dictionary | null => {
const localConfig = readJSONIfExists(
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only gave it a quick look, but it looks like we don't copy the .actor directory in our Dockerfiles anyway, so for the "build a Docker image and run it outside of the platform" use case, the answer to "But I'm not sure how else we would refer to these files" is probably "tough luck lol" 🤷

But if we add a nice error log when there's not input schema to be found, yeah, we can live with that.

@B4nan B4nan changed the title feat: input schema defaults in getInput feat: respect input schema defaults in Actor.getInput() Sep 18, 2025

@B4nan B4nan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few comments from my end

Comment thread packages/apify/src/actor.ts Outdated
Comment thread packages/apify/src/input-schemas.ts Outdated
Comment thread packages/apify/src/actor.ts Outdated
Comment thread packages/apify/src/actor.ts Outdated
Comment thread packages/apify/src/input-schemas.ts
@B4nan

B4nan commented Sep 18, 2025

Copy link
Copy Markdown
Member

@vladfrangu there are some unresolved comments from others too, I'd like to ship next SDK soon, including this PR, let's try to resolve them asap

@vladfrangu

Copy link
Copy Markdown
Member Author

If this is all good from you guys, lets merge it and release it!

Comment thread packages/apify/src/input-schemas.ts Outdated
return null;
};

export const kNoActorInputSchemaDefined = Symbol.for(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really weird naming. also, do we really need to export this symbol? if so, it should be marked as @ignore so it wont end up in the docs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used naming similar to what I've seen in node (and we need it exported to check for it in actor.ts). I'll slap on the ignore tag in a sec

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we already discussed this some time ago. its weird, confusing, and unnecessary, lets not adopt it just because people maintaining node use it.

btw it looks like this file is not exported from the barrel so its fine i guess

@B4nan B4nan merged commit bd9181d into master Oct 6, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support input schema defaults locally in Actor.getInput()

5 participants