Skip to content

fix(jsonapi): unwrap relationship linkage before denormalization - #8730

Open
soyuka wants to merge 2 commits into
api-platform:5.0from
soyuka:fix/jsonapi-constructor-relationship-linkage-8702
Open

soyuka wants to merge 2 commits into
api-platform:5.0from
soyuka:fix/jsonapi-constructor-relationship-linkage-8702

Conversation

@soyuka

@soyuka soyuka commented Oct 19, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 4.4
Tickets Fixes #8702
License MIT
Doc PR ∅

setAttributeValue() strips the data wrapper of relationships.<name>, but constructor arguments never go through it, so to-one linkage failed with "Only resource linkage supported currently" and to-many with a key type error. The data key is now unwrapped on relationships only, where attributes and relationships are merged, an attribute holding a data key is left intact.

Note that the non-spec flat shape (relationships.author: {"type", "id"}) is still accepted, it already was on the property path and rejecting it would be a BC break on 4.4.

Constructor arguments bypass setAttributeValue(), so
`relationships.<name>.data` reached denormalizeRelation() still
wrapped. Unwrap each relationship where attributes and relationships
are merged, attributes are left untouched.

Fixes api-platform#8702
@soyuka
soyuka force-pushed the fix/jsonapi-constructor-relationship-linkage-8702 branch from 8fa4fcb to e619713 Compare October 19, 2026 12:14
@soyuka
soyuka changed the base branch from 4.4 to 5.0 October 19, 2026 12:16
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.

1 participant