Skip to content

Commit

Permalink
fix: add NUXT_PUBLIC_DATBASE env variable to validate step and transf…
Browse files Browse the repository at this point in the history
…orm empty string in the generate script
  • Loading branch information
oliviareichl committed Oct 2, 2024
1 parent 91b4e07 commit 69a7de1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
run: pnpm install --frozen-lockfile
env:
NUXT_PUBLIC_API_BASE_URL: "${{ vars.NUXT_PUBLIC_API_BASE_URL }}"
NUXT_PUBLIC_DATABASE: "${{ vars.NUXT_PUBLIC_DATABASE }}"
NUXT_PUBLIC_OPENAPI_BASE_URL: "${{ vars.NUXT_PUBLIC_OPENAPI_BASE_URL }}"

- name: Format
Expand Down Expand Up @@ -103,6 +104,7 @@ jobs:
env:
NUXT_PUBLIC_API_BASE_URL: "${{ vars.NUXT_PUBLIC_API_BASE_URL }}"
NUXT_PUBLIC_APP_BASE_URL: "http://localhost:3000"
NUXT_PUBLIC_DATABASE: "${{ vars.NUXT_PUBLIC_DATABASE }}"
NUXT_PUBLIC_OPENAPI_BASE_URL: "${{ vars.NUXT_PUBLIC_OPENAPI_BASE_URL }}"
NUXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}"

Expand Down
8 changes: 7 additions & 1 deletion scripts/generate-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import * as v from "valibot";

const schema = v.object({
NUXT_PUBLIC_DATABASE: v.optional(v.picklist(["enabled", "disabled"]), "enabled"),
NUXT_PUBLIC_OPENAPI_BASE_URL: v.optional(v.pipe(v.string(), v.url())),
NUXT_PUBLIC_OPENAPI_BASE_URL: v.pipe(
v.unknown(),
v.transform((v) => {
return v === "" ? undefined : v;
}),
v.optional(v.pipe(v.string(), v.url())),
),
});

async function generate() {
Expand Down

0 comments on commit 69a7de1

Please sign in to comment.