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
fix merging of api resource data fails or has existing data go missing #16146
base: 1.13
Are you sure you want to change the base?
fix merging of api resource data fails or has existing data go missing #16146
Conversation
in case certain xml keys are missing from extending config like properties, item opteration, collection operations or resources
$this->properties[$resourceClass], | ||
$resourceMetadata['properties'], | ||
$this->properties[$resourceClass] ?? [], | ||
$resourceMetadata['properties'] ?? [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null cannot be merged with []
Maybe adjusting \Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\MergingXmlExtractor::buildResource properties to not default to null is better?
@@ -23,6 +23,10 @@ public function merge(array $oldMetadata, array $newMetadata): array | |||
|
|||
foreach ($newMetadata as $key => $value) { | |||
if ('properties' === $key) { | |||
if ($value === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe adjusting \Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\MergingXmlExtractor::buildResource properties is better?
Bunnyshell Preview Environment deployedIt will be automatically stopped in 4 hours. Use the command
Available commands:
|
this may break api's that accidentally exposed |
Hi @esserj and thank you for your contribution. |
in case certain xml keys are missing from extending config like properties, item opteration, collection operations or resources
Basically what happens is that when you define api extension configuration through app (or multiple bundles)
you have to set at least 1 property in the file, oven though you do not want to make any changes (potentially overriding any future changes to it)
and you have to explicitly set every operation type (itemOperations, collectionOperations, resourceOperations) explictly
like
<itemOperations />
etc or you will end up (based on order of execution) with eg default item operation configuration from api platform, or subresouce configation goes mising (e.g order override caused order adjustment subresource config from going awol)