jsonapi
jsonapi copied to clipboard
Allow include in included and data resourses with same id
Say, I have resource structure like this:
{
"data": [
{
"type": "news",
"id": "item1",
"attributes": {
"title": "item1"
},
"relationships": {
"also": {
"data": [{
"type": "news",
"id": "item2"
}]
}
}
},
{
"type": "news",
"id": "item2",
"attributes": {
"title": "item2"
},
"relationships": {
"also": {
"data": [{
"type": "news",
"id": "item3"
}]
}
}
}
]
}
And I want to get resources like this:
{
"data": [
{
"type": "news",
"id": "item1",
"attributes": {
"title": "item1"
},
"relationships": {
"also": {
"data": [{
"type": "news",
"id": "item2"
}]
}
}
},
{
"type": "news",
"id": "item2",
"attributes": {
"title": "item2"
},
"relationships": {
"also": {
"data": [{
"type": "news",
"id": "item3"
}]
}
}
}
],
"included": [
{
"type": "other_companies",
"id": "item2",
"attributes": {
"title": "item2",
"link": "link",
"code": "item2",
...
}
}
]
}
For now there will be triggered error "can not have multiple resources with the same identification".
Can we add individual id validation for included?
Just make another claimUsedResourceIdentifier for included.
Or add option for validator.