fix merging of api resource data fails or has existing data go missing#16146
fix merging of api resource data fails or has existing data go missing#16146esserj wants to merge 1 commit intoSylius:1.14from
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.
null cannot be merged with []
Maybe adjusting \Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\MergingXmlExtractor::buildResource properties to not default to null is better?
|
|
||
| foreach ($newMetadata as $key => $value) { | ||
| if ('properties' === $key) { | ||
| if ($value === null) { |
There was a problem hiding this comment.
maybe adjusting \Sylius\Bundle\ApiBundle\ApiPlatform\Metadata\MergingXmlExtractor::buildResource properties is better?
❌ Preview Environment deleted from BunnyshellAvailable commands:
|
|
this may break api's that accidentally exposed |
|
Hi @esserj and thank you for your contribution. |
| Q | A |-----------------|----- | Branch? | 1.14 <!-- see the comment below --> | Bug fix? | yes | New feature? | no | BC breaks? | no | License | MIT <!-- - Bug fixes must be submitted against the 1.14 or 2.1 branch - Features and deprecations must be submitted against the 2.2 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> continuation of #16146
|
I'm closing the PR in favour of #18725 |
| Q | A |-----------------|----- | Branch? | 1.14 <!-- see the comment below --> | Bug fix? | yes | New feature? | no | BC breaks? | no | License | MIT <!-- - Bug fixes must be submitted against the 1.14 or 2.1 branch - Features and deprecations must be submitted against the 2.2 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> continuation of Sylius/Sylius#16146
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)