Repository navigation
feat(jsonld): expand IRIs in @type discriminators - #8878
Merged
Merged
Conversation
A non-string type property value reached ClassDiscriminatorMapping::getClassForType() and raised a TypeError, turning a malformed payload into a 500.
When a #[DiscriminatorMap] uses @type as its type property, the JSON-LD denormalizer expands the payload types and the mapping keys against the request's inline @context (@vocab, prefixes and term definitions) before matching them. An array @type resolves to its first mapped value. Remote contexts are not dereferenced. Non-resource outputs now keep the @type written by the discriminator instead of the class short name.
This was referenced Nov 26, 2026
soyuka
marked this pull request as ready for review
November 26, 2026 16:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a
#[DiscriminatorMap]uses@typeas its type property, the JSON-LD denormalizer expands the payload@typeand the mapping keys against the request's inline@context(@vocab, prefixes, term definitions) before matching them.LikeActionwith a matching@vocab,schema:LikeActionandhttps://schema.org/LikeActionall resolve to the same class. An array@typeresolves to its first mapped value. Remote contexts are not dereferenced.Non-resource outputs keep the
@typeset by the discriminator instead of the class short name.A separate commit turns the 500 raised by a non-string type property value (array, object, integer) into a 400.
Tests:
tests/Functional/JsonLd/TypeDiscriminatorTest.php,DiscriminatedInputDtoTest::testNonStringTypePropertyIsRejected