You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written a schema as follows in which my goal is that the 'itemOrder' array should always have the same length as the items attr / relationship. When I add the 'when' clause, however, the itemOrder column does not get created (using postgres). If I omit the 'when' clause it does get created. Not sure if this is a bug or if I'm not using / understanding the when clause correctly. Thanks for any help you can offer.
I'm having the same issue with mysql. Without .when it works fine, with .when it drops the column. Even if I set force: false with the column already created, it doesn't handle the field properly. What I mean is that my 'score' field shows as empty in the response even though it's populated in the request and partialResponse objects. I've also verified that this schema works correctly using Joi directly (without jsonapi-server).
{
status: Joi.string().regex(/^queued$|^cancelled$|^processing$|^failed$|^completed$/)
.description("The processing state: queued|cancelled|processing|failed|completed"),
company: Joi.string().required().description("The company the individual is related to."),
individual: Joi.string().required().description("The individual to initiate on."),
score: Joi.number().integer().valid([1,2,3,4])
.description("The normalized score. 1..4 => low..high risk")
.when('status', {is: Joi.string().regex(/^completed$/).required(),
then: Joi.required(),
otherwise: Joi.allow(null).optional()}),
expires: Joi.date().iso()
.description("The date after which the score is no longer "+
"valid.")
.when('status', {is: Joi.string().regex(/^completed$/).required(),
then: Joi.required(),
otherwise: Joi.allow(null).optional()}),
}
I've written a schema as follows in which my goal is that the 'itemOrder' array should always have the same length as the items attr / relationship. When I add the 'when' clause, however, the itemOrder column does not get created (using postgres). If I omit the 'when' clause it does get created. Not sure if this is a bug or if I'm not using / understanding the when clause correctly. Thanks for any help you can offer.
The text was updated successfully, but these errors were encountered: