Skip to content

Commit 5db59b3

Browse files
Fixed an issue where the machine create command would fail with a generic "Required" error
Fixed an issue where the machine create command would fail with a generic "Required" error when optional fields were not provided. The problem was that Zod enum schemas for optional flags (public-ip-type, auto-snapshot-frequency, restore-point-frequency) did not accept undefined values. Added .optional() to these schemas so users now receive proper error messages from the API instead of the unhelpful "Required" error.
1 parent 5cfc593 commit 5db59b3

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/workflows/pull-request.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Deno
2020
uses: denoland/setup-deno@v1
2121
with:
22-
deno-version: 1.x.x
22+
deno-version: 1.38.5
2323

2424
- name: Check types
2525
run: deno check mod.ts
@@ -33,5 +33,8 @@ jobs:
3333
- name: Test
3434
run: deno task test
3535

36+
- name: Ensure output directories exist
37+
run: mkdir -p bin/macos bin/macos-arm bin/linux bin/windows
38+
3639
- name: Build
3740
run: deno task compile

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
- name: Setup Deno
2727
uses: denoland/setup-deno@v1
2828
with:
29-
deno-version: 1.x.x
29+
deno-version: 1.38.5
3030

3131
- name: Install semantic release
3232
run: |
3333
npm init -y
3434
npm i semantic-release @google/semantic-release-replace-plugin @semantic-release/exec
35-
35+
3636
- name: Release
3737
run: npx semantic-release
3838
env:

commands/machine/schemas.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { z } from "../../zcli.ts";
22

3-
export const MachineAutoSnapshotFrequencySchema = z.enum([
4-
"hourly",
5-
"daily",
6-
"weekly",
7-
"monthly",
8-
]);
3+
export const MachineAutoSnapshotFrequencySchema = z
4+
.enum([
5+
"hourly",
6+
"daily",
7+
"weekly",
8+
"monthly",
9+
])
10+
.optional();
911

10-
export const MachineRestorePointFrequencySchema = z.enum(["shutdown"]);
12+
export const MachineRestorePointFrequencySchema = z
13+
.enum(["shutdown"])
14+
.optional();
1115

12-
export const MachinePublicIpTypeSchema = z.enum(["static", "dynamic", "none"]);
16+
export const MachinePublicIpTypeSchema = z
17+
.enum(["static", "dynamic", "none"])
18+
.optional();

0 commit comments

Comments
 (0)