Skip to content

Commit

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

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

Expand Down Expand Up @@ -82,6 +83,10 @@ export type BooleanParameter = BaseParameter & {
default: boolean | null;
};

export type BinaryParameter = BaseParameter & {
type: "binary";
};

export type Parameter =
| DynamicParameter
| DateTimeParameter
Expand All @@ -91,4 +96,5 @@ export type Parameter =
| IntegerParameter
| FloatParameter
| LinkParameter
| BooleanParameter;
| BooleanParameter
| BinaryParameter;

0 comments on commit 7ee7d4e

Please sign in to comment.