Description
I stumbled upon the necessity to remove a parameter override which is defined in a webapi.xml
<route url="/V1/customers" method="POST">
<data>
<parameter name="customer.extension_attributes.company_attributes.company_id" force="true">%company_id%</parameter>
</data>
</route>
My initial though was setting force="false"
should remove the paramter being overwritten by the \Magento\Framework\Webapi\Rest\Request\ParamOverriderInterface
, however that was not the case.
Upon closer look into the schema converter \Magento\Webapi\Model\Config\Converter
that's responsible to read the xml files I found out the line that's responsible to parse the attribute is incorrect.
$force = $forceNode ? (bool)$forceNode->nodeValue : false;
Strings always evaluate to boolean true unless they have a value that's considered "empty" by PHP. PHP empty documentation
""
"0"
Current work around is setting a falsy value so that works
<route url="/V1/customers" method="POST">
<data>
<parameter name="customer.extension_attributes.company_attributes.company_id" force="0">%company_id%</parameter>
</data>
</route>
Preconditions (*)
- vanilla Magento 2.4.3
Steps to reproduce (*)
- Define an existing or new webapi route paramter override with
force="false"
Expected result (*)
- The parameter override should have the value set to
false
Using n98 to inspect (Magento\Webapi\Model\ConfigInterface::getServices()['routes']['V1/customers']
)
[
"POST" => [
"secure" => false,
"service" => [
"class" => "Magento\Customer\Api\AccountManagementInterface",
"method" => "createAccount",
],
"resources" => [
"anonymous" => true,
],
"parameters" => [
"customer.extension_attributes.company_attributes.company_id" => [
"force" => false,
"value" => "%company_id%",
],
],
],
]
Actual result (*)
- The paramter override still has the value
true
Using n98 to inspect
[
"POST" => [
"secure" => false,
"service" => [
"class" => "Magento\Customer\Api\AccountManagementInterface",
"method" => "createAccount",
],
"resources" => [
"anonymous" => true,
],
"parameters" => [
"customer.extension_attributes.company_attributes.company_id" => [
"force" => true, # this is still true
"value" => "%company_id%",
],
],
],
]
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status