Model property typed object validation
Model properties that are a typed objects with validations do not fire validation.
Take these models
// Product
{
"name": "product",
"properties": {
"name": {
"type":"string",
"required": true
},
"part": {
"type":"part",
"required": true
}
}
}
// Part
{
"name":"part",
"properties": {
"price": {
"type": "number",
"required": true
}
}
}
(POST) /api/products
{
"name":"Hello",
"part": {
}
}
I would expect to be given a 422 error stating that price is required on part.price
@jsheely Loopback is not supporting nested validation. I am also facing the same issue.
Exactly. I am closing this issue as a duplicate of #300
I'm also suprised this doesn't work. If you want I'd be willing to make some changes to do nested validation... I presume a lot of people are having to hardcode - we do. If it is planned, do you have an ETA?
Let me know, either way.
@mbana
If you want I'd be willing to make some changes to do nested validation... I presume a lot of people are having to hardcode - we do. If it is planned, do you have an ETA?
We don't have any plans to fix this issue in the near future. A contribution will be welcome!
Let's move further discussions to #300 please.