core icon indicating copy to clipboard operation
core copied to clipboard

"Unable to generate IRI" error after upgrade to 3.3

Open cristi-contiu opened this issue 1 year ago • 1 comments

API Platform version(s) affected: 3.3.0 and above

Description
After upgrading from 3.2 to 3.3, we started getting the "Unable to generate IRI" error for ApiResources without ApiProperty identifier.

The error comes from the RespondProcessor:115 (called from the MainController:111) not being able to generate an IRI to be used in the Content-Location header.

Generating an IRI from the JsonLd\Serializer\ItemNormalizer:127 works OK (as before), because it also passess the $context to the Symfony IriConverter, so it's able to extract the identifier from the URI variables.

How to reproduce
The error is thrown when using an ApiResource that has no ApiProperty identifier, but has an identifier in the URI.

Possible Solution
Pass the operation and context when generating the IRI in the RespondProcessor, so that it matches the one generated for JsonLd in the body (@id).

If it's mandatory for ApiResources to have ApiProperty identifiers starting from a specific ApiPlatform version, please let me know.

cristi-contiu avatar Jul 25 '24 08:07 cristi-contiu

If it's mandatory for ApiResources to have ApiProperty identifiers starting from a specific ApiPlatform version, please let me know.

ApiResource must have an identifier if there's one in the URI Template.

soyuka avatar Aug 08 '24 14:08 soyuka

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 11 '24 23:10 stale[bot]