You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define schemas for type-safe environment variables with Zod, Valibot, or any Standard Schema V1 compliant library
139
139
140
+
**Important: Providing async schema for env variables is not supported, at least for now.**
141
+
140
142
```typescript
141
143
const safeApi =zagora()
142
144
.env(z.object({
@@ -159,6 +161,7 @@ const sum = safeApi(5, 10); // { ok: true, data: 15 + PORT }
159
161
**Important notes:**
160
162
- When `disableOptions` is enabled (eg. `true`) then handler WILL NOT have access to type-safe env vars.
161
163
- When `autoCallable` is enabled (eg. `true`) make sure to provide the runtime env vars as second argument to the `.env(schema, processEnvOrImportMetaEnv)` method.
164
+
- Async schema validation is not supported, for now
Define schemas for type-safe environment variables with Zod, Valibot, or any Standard Schema V1 compliant library
139
139
140
+
**Important: Providing async schema for env variables is not supported, at least for now.**
141
+
140
142
```typescript
141
143
const safeApi =zagora()
142
144
.env(z.object({
@@ -159,6 +161,7 @@ const sum = safeApi(5, 10); // { ok: true, data: 15 + PORT }
159
161
**Important notes:**
160
162
- When `disableOptions` is enabled (eg. `true`) then handler WILL NOT have access to type-safe env vars.
161
163
- When `autoCallable` is enabled (eg. `true`) make sure to provide the runtime env vars as second argument to the `.env(schema, processEnvOrImportMetaEnv)` method.
164
+
- Async schema validation is not supported, for now
Copy file name to clipboardExpand all lines: README.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -653,6 +653,8 @@ You can also provide the cache through `.callable({ cache })`. That is useful, i
653
653
654
654
You can provide the runtime env vars (either `process.env` or `import.meta.env`) through the second argument of `.env(schema, envs)` or at later stage through the `.callable({ env })` call. Either way, they will be validated. The parsed variables will be accessible through the handler's `options` object.
655
655
656
+
**Important: Providing async schema for env variables is not supported, at least for now.**
657
+
656
658
```ts
657
659
const zaWithEnv =zagora()
658
660
.env(z.object({
@@ -672,6 +674,9 @@ Keep in mind that if you have `autoCallable: true` enabled in the instance, then
0 commit comments