EmberData
is POST
ing:
{
"data": {
"attributes": {
"name": "The project name",
"description": "The project description",
"price": 123
},
"relationships": {
"onwer": {
"data": null
}
},
"type": "projects"
}
}
And Django
(drf
I guess) is complaining with a 409 Conflict
:
{
"errors": {
"detail": "The resource object's type (projects) is not the type that constitute the collection represented by the endpoint (project)."
}
}
Apparently the JSONApi
spec does not enforce an inflection rule. How can I tell drf
to accept plurals for the type?
There is a config parameter:
JSON_API_PLURALIZE_RELATION_TYPE = True
You could also explicitly set the resource name:
class CategoryViewSet(viewsets.ModelViewSet):
resource_name = 'categories'
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With