Skip to content

Conversation

fraynaud1330
Copy link
Contributor

@fraynaud1330 fraynaud1330 commented Feb 27, 2023

closes #5402

Fix error in XmlResourceExtractor :

API Platform version(s) affected: 3.1.2

Description
When creating a custom operation with a specific request body in a resource in a XML file we have the following error :
In ResourceExtractorTrait.php line 91: Warning: foreach() argument must be of type array|object, null given

How to reproduce
Create a resource in a XML file with an operation with a specific request body

Possible Solution
Modification in the file src/Metadata/Extractor/XmlResourceExtractor.php line 218 change $this->buildValues($openapi->requestBody->values) to $this->buildValues($openapi->requestBody->content->values) : https://github.com/api-platform/core/blob/3.1/src/Metadata/Extractor/XmlResourceExtractor.php#L218

@fraynaud1330 fraynaud1330 force-pushed the fix-xml-resource-extractor branch 3 times, most recently from 15ceb5e to a96177d Compare February 27, 2023 10:07
@soyuka soyuka changed the base branch from main to 3.1 February 28, 2023 09:32
@soyuka soyuka force-pushed the fix-xml-resource-extractor branch from a96177d to 713ede9 Compare February 28, 2023 09:37
@soyuka soyuka force-pushed the fix-xml-resource-extractor branch from 713ede9 to 6d63c27 Compare February 28, 2023 09:38
@soyuka soyuka merged commit d1d139a into api-platform:3.1 Feb 28, 2023
@soyuka
Copy link
Member

soyuka commented Feb 28, 2023

thanks @fraynaud1330 !

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.

Error in XmlResourceExtractor when building request body content values

2 participants