You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The primary resource is duplicated in the included array in rare corner cases, such as self-referencing relationships or cyclic relationship chains.
I don't know if this was a deliberate choice or just an unnoticed side effect during initial implementation (many years ago, before I joined the project). The behavior could be considered convenient, because clients parsing the included array can look up everything in the array, without falling back to the primary data.
We've changed the logic to build the include array multiple times. But before doing so, we added tests to capture the existing behavior. Therefore it's still working this way today.
The JSON:API specification used to be agnostic about this, but with its recent rewording, this is no longer allowed:
Every included resource object MUST be identified via a chain of relationships originating in a document’s primary data. This means that compound documents require “full linkage” and that no resource object can be included without a direct or indirect relationship to the document’s primary data.
The only exception to the full linkage requirement is when relationship fields that would otherwise contain linkage data are excluded due to sparse fieldsets requested by the client.
DESCRIPTION
The primary resource is duplicated in the
included
array in rare corner cases, such as self-referencing relationships or cyclic relationship chains.I don't know if this was a deliberate choice or just an unnoticed side effect during initial implementation (many years ago, before I joined the project). The behavior could be considered convenient, because clients parsing the
included
array can look up everything in the array, without falling back to the primary data.We've changed the logic to build the
include
array multiple times. But before doing so, we added tests to capture the existing behavior. Therefore it's still working this way today.The JSON:API specification used to be agnostic about this, but with its recent rewording, this is no longer allowed:
STEPS TO REPRODUCE
See cases in IntegrationTests/QueryStrings/Includes/IncludeTests.cs.
EXPECTED BEHAVIOR
The primary resource is never duplicated in the
included
array in response bodies.ACTUAL BEHAVIOR
Duplication may occur.
VERSIONS USED
The text was updated successfully, but these errors were encountered: