Skip to content

Conversation

harshalkalewar
Copy link

Fixes #1109. Ensures top-level 'included' is returned as [] when the query param ?include= is provided but no related resources exist. Updates integration tests to reflect JSON:API v1.1 spec compliance.

Changes

  • Updates JSONRenderer.render() to always include an "included" key when the request contains ?include=, even if no related resources are present.
  • Keeps existing behavior of omitting "included" when no include param is provided.
  • Adds integration tests for both scenarios.
  • Updates test_missing_field_not_included to expect "included": [] instead of no key.

Why

Aligns behavior with the JSON:API v1.1 specification,
which requires the included member to be present when requested, even if empty.

Checklist

  • [✅ ] PR only contains one change (considered splitting up PR)
  • [✅ ] unit-test added
  • [ X] documentation updated
  • [ X] CHANGELOG.md updated (only for user relevant changes)
  • [ X] author name in AUTHORS

Fixes django-json-api#1109. Ensures top-level 'included' is returned as [] when the query param
?include= is provided but no related resources exist. Updates integration tests
to reflect JSON:API v1.1 spec compliance.
@harshalkalewar
Copy link
Author

Fixed tox lint config issue. Also, verified locally with tox -e lint and all checks passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON API 1.1: return included array even if nothing is included
1 participant