Search code examples
djangoember-datadjango-rest-frameworkjson-api

Conflict in type inflection between EmberData and Django REST framework


EmberData is POSTing:

{
  "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?


Solution

  • There is a config parameter:

    JSON_API_PLURALIZE_RELATION_TYPE = True