Skip to content

Commit 48ce78a

Browse files
author
Olexii Korshenko
committed
Merge pull request magento#1026 from magento-folks/combined
Bug Fixes: Api, Tango
2 parents 0ea6083 + ff389b8 commit 48ce78a

File tree

15 files changed

+127
-58
lines changed

15 files changed

+127
-58
lines changed

app/code/Magento/Backend/view/adminhtml/layout/adminhtml_auth_login.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
-->
77
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="empty" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
88
<body>
9+
<remove name="legal"/>
910
<referenceContainer name="main.content">
1011
<block class="Magento\Backend\Block\Template" name="content" template="admin/login.phtml">
1112
<block class="Magento\Backend\Block\Page\Copyright" name="copyright" as="copyright"/>

app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
55
*/
66
-->
7-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
7+
<page layout="admin-empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
88
<body>
9-
<remove name="left"/>
10-
<referenceBlock name="attribute_edit_content">
11-
<arguments>
12-
<argument name="template" xsi:type="string">Magento_Catalog::catalog/product/attribute/form.phtml</argument>
13-
</arguments>
14-
<container name="form" label="Form">
15-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main" as="main"/>
16-
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options" as="advanced-options"/>
17-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced" as="options"/>
18-
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Labels" as="labels"/>
19-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front" as="front-options"/>
20-
</container>
21-
</referenceBlock>
9+
<remove name="legal"/>
10+
<referenceContainer name="content">
11+
<block template="Magento_Catalog::catalog/product/attribute/form.phtml" class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit" name="attribute_edit_content">
12+
<container name="form" label="Form">
13+
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Main" as="main"/>
14+
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options" as="advanced-options"/>
15+
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced" as="options"/>
16+
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Labels" as="labels"/>
17+
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front" as="front-options"/>
18+
</container>
19+
</block>
20+
<block class="Magento\Backend\Block\Template" name="attribute_edit_js" template="Magento_Catalog::catalog/product/attribute/js.phtml"/>
21+
</referenceContainer>
2222
</body>
2323
</page>

app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_attribute_edit_product_tab_variations_popup.xml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@
44
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
55
*/
66
-->
7-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
8-
<body>
9-
<remove name="left"/>
10-
<referenceBlock name="attribute_edit_content">
11-
<arguments>
12-
<argument name="template" xsi:type="string">Magento_Catalog::catalog/product/attribute/form.phtml</argument>
13-
</arguments>
14-
<container name="form" label="Form">
15-
<block class="Magento\ConfigurableProduct\Block\Adminhtml\Product\Attribute\Edit\Tab\Variations\Main" as="main"/>
16-
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options" as="advanced-options"/>
17-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Advanced" as="options"/>
18-
<block class="Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Labels" as="labels"/>
19-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front" as="front-options"/>
20-
</container>
21-
</referenceBlock>
22-
</body>
7+
<page layout="admin-empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
8+
<update handle="catalog_product_attribute_edit_popup"/>
239
</page>

app/code/Magento/Theme/view/adminhtml/layouts.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
-->
77
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/PageLayout/etc/layouts.xsd">
8+
<layout id="admin-empty">
9+
<label translate="true">Admin empty</label>
10+
</layout>
811
<layout id="admin-1column">
912
<label translate="true">Admin 1column</label>
1013
</layout>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
5+
*/
6+
-->
7+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd">
8+
<container name="root">
9+
<container name="page.formkey" as="page.formkey"/>
10+
<container name="page.js.translate" as="page.js.translate"/>
11+
<container name="content" as="content"/>
12+
<container name="js" as="js" label="JavaScript"/>
13+
</container>
14+
</layout>

app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(\Magento\Core\Helper\Data $helper, State $appState)
3636
* @param string $encodedBody Posted content from request.
3737
* @return array|null Return NULL if content is invalid.
3838
* @throws \InvalidArgumentException
39-
* @throws \Magento\Webapi\Exception If decoding error occurs or in case of empty argument type
39+
* @throws \Magento\Webapi\Exception If decoding error was encountered.
4040
*/
4141
public function deserialize($encodedBody)
4242
{
@@ -45,9 +45,6 @@ public function deserialize($encodedBody)
4545
sprintf('"%s" data type is invalid. String is expected.', gettype($encodedBody))
4646
);
4747
}
48-
if (empty($encodedBody)) {
49-
throw new \Magento\Webapi\Exception(__('Request body should not be empty.'));
50-
}
5148
try {
5249
$decodedBody = $this->_helper->jsonDecode($encodedBody);
5350
} catch (\Zend_Json_Exception $e) {

app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(\Magento\Framework\Xml\Parser $xmlParser, State $app
4141
* @param string $xmlRequestBody XML document
4242
* @return array Data converted from XML document to array. Root node is excluded from response.
4343
* @throws \InvalidArgumentException In case of invalid argument type.
44-
* @throws \Magento\Webapi\Exception If decoding error occurs or in case of empty argument type
44+
* @throws \Magento\Webapi\Exception If decoding error occurs.
4545
*/
4646
public function deserialize($xmlRequestBody)
4747
{
@@ -50,9 +50,6 @@ public function deserialize($xmlRequestBody)
5050
sprintf('"%s" data type is invalid. String is expected.', gettype($xmlRequestBody))
5151
);
5252
}
53-
if (empty($xmlRequestBody)) {
54-
throw new \Magento\Webapi\Exception(__('Request body is expected.'));
55-
}
5653
/** Disable external entity loading to prevent possible vulnerability */
5754
$previousLoaderState = libxml_disable_entity_loader(true);
5855
set_error_handler([$this, 'handleErrors']);

app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\Api\AttributeValue;
1111
use Magento\Framework\Api\Config\Reader as ServiceConfigReader;
1212
use Magento\Framework\Api\SimpleDataObjectConverter;
13+
use Magento\Framework\Exception\InputException;
1314
use Magento\Framework\Exception\SerializationException;
1415
use Magento\Framework\Reflection\TypeProcessor;
1516
use Magento\Framework\Serialization\DataBuilderFactory;
@@ -71,6 +72,7 @@ public function __construct(
7172
* @param string $serviceMethodName name of the method that we are trying to call
7273
* @param array $inputArray data to send to method in key-value format
7374
* @return array list of parameters that can be used to call the service method
75+
* @throws InputException if no value is provided for required parameters
7476
*/
7577
public function getInputData($serviceClassName, $serviceMethodName, array $inputArray)
7678
{
@@ -82,6 +84,7 @@ public function getInputData($serviceClassName, $serviceMethodName, array $input
8284
$params = $serviceMethod->getParameters();
8385

8486
$inputData = [];
87+
$inputError = [];
8588
foreach ($params as $param) {
8689
$paramName = $param->getName();
8790
$snakeCaseParamName = strtolower(preg_replace("/(?<=\\w)(?=[A-Z])/", "_$1", $paramName));
@@ -93,7 +96,21 @@ public function getInputData($serviceClassName, $serviceMethodName, array $input
9396
$paramType = $this->getParamType($param);
9497
$inputData[] = $this->_convertValue($paramValue, $paramType);
9598
} else {
96-
$inputData[] = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null;
99+
if ($param->isDefaultValueAvailable()) {
100+
$inputData[] = $param->getDefaultValue();
101+
} else {
102+
$inputError[] = $paramName;
103+
}
104+
}
105+
}
106+
107+
if (!empty($inputError)) {
108+
$exception = new InputException();
109+
foreach ($inputError as $errorParamField) {
110+
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => $errorParamField]);
111+
}
112+
if ($exception->wasErrorAdded()) {
113+
throw $exception;
97114
}
98115
}
99116

dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/AllSoapAndRestInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $en
4141
/**
4242
* Update existing item.
4343
*
44-
* @param string $firstId
45-
* @param string $secondId
44+
* @param string $parentId
45+
* @param string $entityId
4646
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
4747
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
4848
*/
4949
public function nestedUpdate(
50-
$firstId,
51-
$secondId,
50+
$parentId,
51+
$entityId,
5252
\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
5353
);
5454
}

0 commit comments

Comments
 (0)