Improve the guess payload validation schema
This commit is contained in:
parent
1dc71eccae
commit
70d7350474
1 changed files with 5 additions and 1 deletions
|
|
@ -13,7 +13,11 @@ const route: ServerRoute = {
|
||||||
}),
|
}),
|
||||||
payload: Joi.object({
|
payload: Joi.object({
|
||||||
type: Joi.string().valid(`letter`, `solve`),
|
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(),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue