Skip to content

Commit

Permalink
fix: add boolean parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyichv committed Sep 17, 2024
1 parent 8c38799 commit 85a5aa2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-ladybugs-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"arke-zod": patch
---

fix: add boolean parameter
2 changes: 2 additions & 0 deletions src/core/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ function parseType(parameter: Parameter) {
return "z.number()";
case "integer":
return "z.number().int()";
case "boolean":
return "z.boolean()";
default:
throw new Error(`Unknown type: ${parameter.type}`);
}
Expand Down
11 changes: 9 additions & 2 deletions src/utils/temp-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export type BaseParameter = {
| "dynamic"
| "date"
| "integer"
| "float";
| "float"
| "boolean";
required: boolean;
};

Expand Down Expand Up @@ -76,6 +77,11 @@ export type LinkParameter = BaseParameter & {
};
};

export type BooleanParameter = BaseParameter & {
type: "boolean";
default: boolean | null;
};

export type Parameter =
| DynamicParameter
| DateTimeParameter
Expand All @@ -84,4 +90,5 @@ export type Parameter =
| StringParameter
| IntegerParameter
| FloatParameter
| LinkParameter;
| LinkParameter
| BooleanParameter;

0 comments on commit 85a5aa2

Please sign in to comment.