cancel
Showing results for 
Search instead for 
Did you mean: 

Broken REST result for empty object references

0 Kudos

Broken REST result for empty object references

Feature request from wienczny, posted on GitHub Jun 13, 2016

According to the Swagger documentation "extension_attributes" is a reference to an attributes object. If there are no extension attributes the API returns an empty array []. This is illegal according to the Swagger documentation. It has to be either null if there is no object attached or an object {}.

I found this using the Java Swagger client and a product request:

{
  "id": 1,
  "sku": "test",
  "name": "Test",
  "attribute_set_id": 4,
  "price": 12,
  "status": 1,
  "visibility": 4,
  "type_id": "simple",
  "created_at": "2016-04-30 11:02:24",
  "updated_at": "2016-06-10 12:47:19",
  "weight": 5,
  "extension_attributes": [],
  "product_links": [],
  "options": [],
  "media_gallery_entries": [],
  "tier_prices": [],
  "custom_attributes": [
    {
      "attribute_code": "meta_title",
      "value": "Test"
    },
    {
      "attribute_code": "meta_keyword",
      "value": "Test"
    },
    {
      "attribute_code": "meta_description",
      "value": "Test "
    },
    {
      "attribute_code": "category_ids",
      "value": [
        "2",
        "3"
      ]
    },
    {
      "attribute_code": "options_container",
      "value": "container2"
    },
    {
      "attribute_code": "required_options",
      "value": "0"
    },
    {
      "attribute_code": "has_options",
      "value": "0"
    },
    {
      "attribute_code": "url_key",
      "value": "test"
    },
    {
      "attribute_code": "tax_class_id",
      "value": "2"
    }
  ]
}

I had to modify the swagger definition because of #2310 to get this far.