1.
I've temporary solved changing originaly created classes with:
instead using "CatalogDataProductExtensionInterface", used "Object" and
Same issue was with class:
FrameworkAttributeInterface
so i've changed:
field "value" (String) to "value" Object.
Problem is, when I've retreive data expected result is not the same like generated classes:
Result give Array instead of Object of CatalogDataProductExtensionInterface.
I understand it can be some differences with client but NOT data types
I'm having same problem.
Hi @albertixcom
We are not responsible for the generated Java code.
If you identify an error in the magent芯 code, please let us know.
The method "catalogProductRepositoryV1GetGet" works fine on generated api client on php for 2.1.9 version.
@albertixcom, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9
Have same issue and I'm afraid it is not java related.
I'm doing a call to REST API like this
https://magento.host/rest/V1/products/test?editMode=false&storeId=1&forceReload=true
and I got this (part of JSON which is related to problem) :
"custom_attributes": [
{
"attribute_code": "meta_title",
"value": "test"
},
{
"attribute_code": "meta_keyword",
"value": "test"
},
...
{
"attribute_code": "category_ids",
"value": [
"2"
]
},
As you can see, sometimes "value" is a String, and sometimes (category_ids) is an array of Strings. It is hard to deserialize from JSON. We can't define a data model class with field 'value' which is String and String[] at the same time :)
Moreover, Magento2 REST API Swagger definition states that :
"custom_attributes": [
{
"attribute_code": "string",
"value": "string"
}
]
So generated code is expecting String, but got String[].
Working with the CatalogProductRepositoryV1Api in Magento 2.2.5 the swagger definition defines the value as a string.
I have included a sample of the return from the custom_attributes section as well as the swagger definition for the FrameworkAttributesInterface
Also include is sample from \Magento\Eav\Api\Data\AttributeInterface
**
* Retrieve specific attribute
*
* @param string $entityTypeCode
* @param string $attributeCode
* @return \Magento\Eav\Api\Data\AttributeInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function get($entityTypeCode, $attributeCode);
{"attribute_code":"category_ids","value":["26","8","7","141"]},
"framework-attribute-interface": {
"type": "object",
"description": "Interface for custom attribute value.",
"properties": {
"attribute_code": {
"type": "string",
"description": "Attribute code"
},
"value": {
"type": "string",
"description": "Attribute value"
}
},
"required": [
"attribute_code",
"value"
]
},
I'm sorry did you guys not comprehend something correctly?
The Magento 2 swagger spec, doesn't describe the data received. The error we're having has to do with auto-generating functions based off the spec.