Skip to content

fix(jsonld): reset gen_id configuration#7263

Merged
soyuka merged 1 commit into
api-platform:4.1from
soyuka:fix/genid
Jun 30, 2025
Merged

fix(jsonld): reset gen_id configuration#7263
soyuka merged 1 commit into
api-platform:4.1from
soyuka:fix/genid

Conversation

@soyuka

@soyuka soyuka commented Jun 30, 2025

Copy link
Copy Markdown
Member
Q A
Branch? 4.1
Tickets Closes #7258 #7261
License MIT

I failed reproducing the users bc breaks, I think I isolated the behavior though, @norkunas @GSadee may you please check this patch and tell me if it solves your issues? Also would it be possible to have a look at my test fixtures and let me know how your configuration differs from my test?


if (true === ($context['output']['gen_id'] ?? true) && true === ($context['force_iri_generation'] ?? true) && $iri = $this->iriConverter->getIriFromResource($object, UrlGeneratorInterface::ABS_PATH, $context['operation'] ?? null, $context)) {
$operation = $context['operation'] ?? null;
if (true === ($context['output']['gen_id'] ?? true) && true === ($context['force_iri_generation'] ?? true) && $iri = $this->iriConverter->getIriFromResource($object, $operation?->getUrlGenerationStrategy() ?? UrlGeneratorInterface::ABS_PATH, $operation, $context)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably not a necessary patch but it's probably better then the previous code

}

unset($context['iri'], $context['uri_variables'], $context['item_uri_template'], $context['force_resource_class']);
unset($context['iri'], $context['uri_variables'], $context['item_uri_template'], $context['force_resource_class'], $context['output']['gen_id']);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably reset the gen_id context between child context generation

@soyuka soyuka merged commit 454fe71 into api-platform:4.1 Jun 30, 2025
100 of 221 checks passed
@soyuka

soyuka commented Jun 30, 2025

Copy link
Copy Markdown
Member Author

Didn't meant to merge this, its back at #7264

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.

1 participant