Skip to content

feat(serializer): resource polymorphism - #8884

Merged
soyuka merged 1 commit into
polymorphism/1-metadatafrom
polymorphism/2-serializer
Nov 27, 2026
Merged

soyuka merged 1 commit into
polymorphism/1-metadatafrom
polymorphism/2-serializer

Conversation

@soyuka

@soyuka soyuka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets Closes #2931, closes #6915
License MIT
Doc PR

Reads and writes the subtypes declared in the serializer #[DiscriminatorMap] of a resource, in JSON-LD, Hydra, HAL and JSON:API. An update never changes the subtype: a PUT or PATCH with another type returns a 422, a PUT without the type property keeps the subtype.

Test: tests/Functional/DiscriminatedResourceTest.php, ConvertedTypePropertyTest.php, DiscriminatedResourceWithoutPolymorphismTest.php, JsonLd/SharedTypeIriTest.php

Part 2/6 of the polymorphism stack (#8889), replaces #8874.

@soyuka
soyuka added this pull request to stack #8889 November 26, 2026 17:08
@soyuka
soyuka force-pushed the polymorphism/2-serializer branch 2 times, most recently from 07f0393 to 0dd3dda Compare November 27, 2026 10:25
Read, write and document the subtypes declared in the serializer
`#[DiscriminatorMap]` of a resource, in JSON-LD, Hydra, HAL and JSON:API.
An update never changes the subtype: a `PUT` or `PATCH` with another type
returns a 422 (`UnprocessableValueException`).

Co-authored-by: Dylan van der Hout <dylan@rumble.nl>
Co-authored-by: Maxcastel <maxence.nord@gmail.com>
@soyuka
soyuka force-pushed the polymorphism/2-serializer branch from 0dd3dda to 89fc0e7 Compare November 27, 2026 14:55
@soyuka
soyuka removed this pull request from stack #8889 November 27, 2026 14:56
@soyuka
soyuka added this pull request to stack #8896 November 27, 2026 14:56
@soyuka
soyuka merged commit a78f351 into main Nov 27, 2026
82 of 231 checks passed
@soyuka
soyuka deleted the polymorphism/2-serializer branch November 27, 2026 14:56
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.

Add polymorphism support (based on discriminator) Entity inheritance normalises based on parent class

1 participant