Revert "Validate lowLimitProb < highLimitProb"

This reverts commit c261fc2743.
This commit is contained in:
James Grugett 2022-07-21 12:30:08 -05:00
parent 1ae6756f8f
commit 00dd88c9fb

View File

@ -29,26 +29,16 @@ const bodySchema = z.object({
amount: z.number().gte(1), amount: z.number().gte(1),
}) })
const binarySchema = z const binarySchema = z.union([
.union([ z.object({
z.object({ outcome: z.enum(['YES', 'NO']),
outcome: z.enum(['YES', 'NO']), limitProb: z.number().gte(0.001).lte(0.999).optional(),
limitProb: z.number().gte(0.001).lte(0.999).optional(), }),
}), z.object({
z.object({ lowLimitProb: z.number().gte(0.001).lte(0.999),
lowLimitProb: z.number().gte(0.001).lte(0.999), highLimitProb: z.number().gte(0.001).lte(0.999),
highLimitProb: z.number().gte(0.001).lte(0.999), }),
}), ])
])
.superRefine((data, ctx) => {
if ('lowLimitProb' in data && data.lowLimitProb >= data.highLimitProb) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ['lowLimitProb'],
message: 'lowLimitProb should be less than highLimitProb',
})
}
})
const freeResponseSchema = z.object({ const freeResponseSchema = z.object({
outcome: z.string(), outcome: z.string(),