Skip to content

fix: identify already tracked resources by ID AND type#7770

Open
elfin-sbreuers wants to merge 1 commit intoapi-platform:4.2from
elfin-sbreuers:fix_jsonapi_included_skips_other_entity_with_same_id
Open

fix: identify already tracked resources by ID AND type#7770
elfin-sbreuers wants to merge 1 commit intoapi-platform:4.2from
elfin-sbreuers:fix_jsonapi_included_skips_other_entity_with_same_id

Conversation

@elfin-sbreuers
Copy link
Contributor

Fixes a bug in JSON:API serialization where resources with the same numeric ID but different types were incorrectly considered duplicates.
Now, the type is combined with the id to uniquely identify each included resource, ensuring all distinct entities appear in the included section.

currently entities with same ID are skipped since different entities can have
the same ID.
@soyuka
Copy link
Member

soyuka commented Feb 17, 2026

Quite nice, if you could add a test it'd be awesome

@elfin-sbreuers
Copy link
Contributor Author

I want to help protect this fix with a regression test, but I don’t see any JSON:API tests in the suite I could build on. I’m happy to work on adding one — just looking for guidance on where it would fit best and how to start with it.

@soyuka
Copy link
Member

soyuka commented Feb 17, 2026

tests/Functional/JsonApiTest.php for example
there's also a test failure that looks related I think we need to update the behat test (or you can remove that test from behat and reproduce it into phpunit)

@elfin-sbreuers
Copy link
Contributor Author

Thanks for the pointers! I took a look at tests/Functional/JsonApiTest.php. Right now it references a non-existing endpoint and doesn’t include concrete data assertions, so what I need is more of a starting template. I’d appreciate some guidance on setting up a realistic URL and test data structure to properly assert expected return values.

Regarding the Behat test, I’m not sure where to begin. I’m comfortable with JSON:API and Symfony (which is how I identified the underlying issue and fix), but I’d value some pointers on how best to integrate or update the test.

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

Comments