Skip to content

fix(serializer): reject a non-string id in JSON-LD and JSON:API relations - #8778

Merged
soyuka merged 4 commits into
api-platform:5.0from
BenMacha:fix-jsonld-jsonapi-non-string-id-5-0
Nov 3, 2026
Merged

soyuka merged 4 commits into
api-platform:5.0from
BenMacha:fix-jsonld-jsonapi-non-string-id-5-0

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 1, 2026

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
Tickets
License MIT
Doc PR

A non-string @id in a nested JSON-LD document ({"author": {"@id": 123}}), or a non-string id in a JSON:API relationship linkage ("id": ["x"]), was passed to getResourceFromIri(string $iri) and gave a TypeError (500). Both now throw a user-facing NotNormalizableValueException, so a 400 with a violation on the property path. In JSON:API entity-identifier mode an integer id is still accepted, as before.

Tests: tests/JsonLd/Serializer/ItemDenormalizerTest.php (new) and src/JsonApi/Tests/Serializer/ItemDenormalizerTest.php.

…ions

A nested JSON-LD document with a non-string "@id" (e.g. {"author":{"@id":123}})
or a JSON:API relationship linkage with a non-string "id" was passed straight to
IriConverterInterface::getResourceFromIri(), raising a TypeError and a 500.
Such values now raise a NotNormalizableValueException, reported as a 400.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-01T08:05:55.013452Z
We couldn’t complete this review. Comment @codex review to try again.
88ae920 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@soyuka
soyuka merged commit 7700d70 into api-platform:5.0 Nov 3, 2026
100 of 117 checks passed
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.

2 participants