Skip to content

fix(serializer): Fix exception message to not expose resource FQCN #7156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

alexndlm
Copy link
Contributor

Q A
Branch? 4.1
Tickets Closes #7149
License MIT
Doc PR

@@ -228,13 +228,13 @@ public function denormalize(mixed $data, string $class, ?string $format = null,
throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
}

throw NotNormalizableValueException::createForUnexpectedDataType(\sprintf('The type of the "%s" resource "string" (IRI), "%s" given.', $resourceClass, \gettype($data)), $data, [$resourceClass], $context['deserialization_path'] ?? null, true, $e->getCode(), $e);
throw NotNormalizableValueException::createForUnexpectedDataType($e->getMessage(), $data, [$resourceClass], $context['deserialization_path'] ?? null, true, $e->getCode(), $e);
Copy link
Member

Choose a reason for hiding this comment

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

can't we use $operation->getShortName() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can have FQCN in other places, like https://github.com/api-platform/core/pull/6761/files.

What do you think about #7158?

Copy link
Member

Choose a reason for hiding this comment

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

I'll merge #7158, should I merge this one as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jontsa will this PR and #7158 fix your problem?

Copy link

Choose a reason for hiding this comment

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

@alexndlm Yes, thank you!

@alexndlm alexndlm requested a review from soyuka May 19, 2025 15:05
@soyuka soyuka merged commit f789860 into api-platform:4.1 May 22, 2025
93 of 94 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.

3 participants