jsonapi-suite / jsonapi_compliable

MIT License
20 stars 35 forks source link

Fix bug causing missing fields #80

Closed aribouius closed 6 years ago

aribouius commented 6 years ago

Fixes a bug introduced by https://github.com/jsonapi-suite/jsonapi_compliable/pull/77 that results in missing fields for one or more resources when the following conditions are met:

For example: /api/posts?include=author&extra_fields[posts]=comment_count&fields[author]=name

Would yield the following payload:

{
  "data": [
    {
      "type": "posts",
      "attributes": {
        "comment_count": 1 // missing default fields!
      }
    }
  ],
  "included": [
    {
      "type": "authors",
      "attributes": {
        "name": "John"
      }
    }
  ]
}
richmolj commented 6 years ago

Excellent, great catch! Glad we have a test for now now.