Closed
Description
Example: An Owner can have many Pets. A Pet has only one Owner.
But if I try to send invalid PATCH (array of Owners):
{
"data": {
"type": "pets",
"id": "1",
"attributes": {
"someValue": true
},
"relationships": {
"owner": {
"data": [{
"type": "owners",
"id": "1"
}]
}
}
}
}
(Type member is not a string, or is empty. at /var/www/vendor/cloudcreativity/laravel-json-api/src/Object/IdentifiableTrait.php:47
)
or an invalid PATCH (Pet object)
{
"data": {
"type": "owners",
"id": "1",
"attributes": {
"someValue": true
},
"relationships": {
"pets": {
"data": {
"type": "pets",
"id": "1"
}
}
}
}
}
(Argument 1 passed to CloudCreativity\LaravelJsonApi\Object\ResourceIdentifier::fromArray() must be of the type array, string given
)
I get an HTTP 500 (see errors above).
How or where to check if relationship is a valid Array (HasMany) or object (HasOne)?