0
0
Fork 0

Improve the guess payload validation schema

This commit is contained in:
Oliver-Akins 2023-02-20 20:22:06 -07:00
parent 1dc71eccae
commit 70d7350474

View file

@ -13,7 +13,11 @@ const route: ServerRoute = {
}),
payload: Joi.object({
type: Joi.string().valid(`letter`, `solve`),
guess: Joi.string().length(1),
guess: Joi.when(`type`, {
is: `letter`,
then: Joi.string().length(1),
otherwise: Joi.string(),
}),
}),
},
},