Move booleanSchema to sanitizedSchema

This commit is contained in:
carlosmonastyrski
2025-03-21 18:29:55 -03:00
parent e2e0f6a346
commit d918dd8967
3 changed files with 20 additions and 27 deletions
@@ -70,6 +70,19 @@ export const DefaultResponseErrorsSchema = {
})
};
export const booleanSchema = z
.union([z.boolean(), z.string().trim()])
.transform((value) => {
if (typeof value === "string") {
// ie if not empty, 0 or false, return true
return Boolean(value) && Number(value) !== 0 && value.toLowerCase() !== "false";
}
return value;
})
.optional()
.default(false);
export const sapPubSchema = SecretApprovalPoliciesSchema.merge(
z.object({
environment: z.object({