-
Notifications
You must be signed in to change notification settings - Fork 51
feat: input schema defaults in getInput #409
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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!
return null; | ||
} | ||
|
||
export const readInputSchema = (): Dictionary | null => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we make all of them (readJSONIfExists
, readInputSchema
, getDefaultsFromInputSchema
) function
(or make all of them const
arrow function)?
|
||
export const readInputSchema = (): Dictionary | null => { | ||
const localConfig = readJSONIfExists( | ||
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
.build(env.actorBuildId) | ||
.get(); | ||
|
||
inputSchema = buildData?.actorDefinition?.input; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would at least log an error if this is not present in the response.
inputSchema = buildData?.actorDefinition?.input; | ||
} else { | ||
// On local, we can get the input schema from the local config | ||
inputSchema = readInputSchema(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd also be nice to log something if no input schema is found.
|
||
export const readInputSchema = (): Dictionary | null => { | ||
const localConfig = readJSONIfExists( | ||
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME), |
There was a problem hiding this comment.
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.
Way too overdue, closes #287