Skip to content

Commit

Permalink
Improve warnings related to functions[].handler
Browse files Browse the repository at this point in the history
Signed-off-by: Andreia Ocănoaia <[email protected]>
  • Loading branch information
andreia-oca committed Feb 13, 2025
1 parent b18c9ef commit 9d757d2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/projectConfiguration/yaml/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,25 @@ function parseGenezioConfig(config: unknown) {
.refine(({ functions }) => {
const isUniqueFunction = isUnique(functions ?? [], "name");
return isUniqueFunction;
}, `You can't have two functions with the same name.`);
}, `You can't have two functions with the same name.`)
.refine(({ functions }) => {
for (const func of functions ?? []) {
if (func.type === FunctionType.aws && !func.handler) {
return false;
}
}
return true;
}, `functions[].handler is mandatory for functions with type aws.`)
.refine(({ functions }) => {
if (languageSchema.parse({ name: Language.python }).name === Language.python) {
for (const func of functions ?? []) {
if (!func.handler) {
return false;
}
}
}
return true;
}, ` functions[].handler is mandatory for python functions.`);

const frontendSchema = zod.object({
name: zod.string().optional(),
Expand Down

0 comments on commit 9d757d2

Please sign in to comment.