fix(jsonld): allow @id, @context and @type on denormalization
#6225
General question. I think I saw it written somewhere but I can't find it now. What is the easiest way to test a fork? like in an existing api-platform template clone, replace the /vendor/api-platform/core with the peached version to see if it works.
Anyway I think it's not working as in Symfony here
isAllowedAttribute() is not called if it's not in $allowedAttributes that is set here from:
https://github.com/api-platform/core/blob/73a4c324a3fe8d7e40ed2232c1e91cd0b4731805/src/Serializer/AbstractItemNormalizer.php#L418-L443
where $allowedAttributes = []; is empty and gets filled only with items from the object && isAllowedAttribute() and in our case there are not in the object so isAllowedAttribute() is not checked.
Hi, the best way to test the branch is to use https://getcomposer.org/doc/05-repositories.md#vcs with the fork and the branch
So as I said above https://github.com/api-platform/core/pull/6402#issuecomment-2142494980 this seems not to have any effect.
I don't quite understand Symfony's point of isAllowedAttribute() if it's being superseded by getAllowedAttributes().
But this approach I made before works https://github.com/api-platform/core/pull/6274/. So using the same approach but instead of adding a new context option I just did what you did and added the items. branch: https://github.com/ili101/api-platform-core/tree/id (https://github.com/ili101/api-platform-core/commit/7f483074a757a395e378ff5ef8cf963b6e5a5ec1)
Edit: moved to JsonLd ItemNormalizer https://github.com/ili101/api-platform-core/commit/ad132ad7ee62b8756a3f1291cfd0c73c0cfa237b
And with this it's possible to use the @id as described in the documentation while using allow_extra_attributes: false
nice, can you open a new PR to replace mine?
superseeded by https://github.com/api-platform/core/pull/6451