We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f7d29c commit 55929f7Copy full SHA for 55929f7
1 file changed
src/schemas/common.ts
@@ -128,11 +128,14 @@ export const booleanSchema = (
128
const baseSchema = z.boolean().describe(description);
129
130
if (defaultValue !== undefined) {
131
- const schemaWithDefault = baseSchema.default(defaultValue);
132
- return optional ? schemaWithDefault.optional() : schemaWithDefault;
+ return baseSchema.default(defaultValue);
133
}
134
135
- return optional ? baseSchema.optional() : baseSchema;
+ if (optional) {
+ return baseSchema.optional();
136
+ }
137
+
138
+ return baseSchema;
139
};
140
141
/**
0 commit comments