Skip to content

Commit 1c7157f

Browse files
committed
feat: create Zod's default function for entity's booleans
Signed-off-by: Théo Frison <[email protected]>
1 parent 9017a13 commit 1c7157f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/schema/src/plugins/zod/utils/schema-gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
isInvocationExpr,
2121
isNumberLiteral,
2222
isStringLiteral,
23+
isBooleanLiteral
2324
} from '@zenstackhq/sdk/ast';
2425
import { upperCaseFirst } from 'upper-case-first';
2526
import { name } from '..';
@@ -282,6 +283,8 @@ export function getFieldSchemaDefault(field: DataModelField) {
282283
return JSON.stringify(arg.value.value);
283284
} else if (isNumberLiteral(arg.value)) {
284285
return arg.value.value;
286+
} else if (isBooleanLiteral(arg.value)) {
287+
return arg.value.value;
285288
} else if (
286289
isInvocationExpr(arg.value) &&
287290
isFromStdlib(arg.value.function.ref!) &&

0 commit comments

Comments
 (0)