I have two Models defined; Location and Address, defined as follows:
"address": {
"properties": {
"address1": {
"type": "string",
"required": true
}
},
"public": true,
"dataSource": "db",
"plural": "addresses"
},
"location": {
"properties": {
"title": {
"type": "string"
},
"address":{
"type": "address",
"required": true
}
},
"public": true,
"dataSource": "db",
"plural": "locations"
}
When I Create an object based on the address Model via the API Explorer, the required constraint on address1 behaves as expected and I must supply a value to create the object.
When I Create an object based on the location Model via the API Explorer, the required constraint on the address works as expected, but the required constraint on the address1 of the address Model does not. I am able to create an address without an address1, which is not what I would expect.
Am I doing something wrong or is validation only performed on the root object?
I am using a memory datasource, node v0.10.24 and loopback v1.8.6.
At this moment, validations only happen at root level. Can you open an issue at https://github.com/strongloop/loopback-datasource-juggler?
BTW, I recommend you post questions to https://groups.google.com/forum/#!forum/loopbackjs for prompt responses.