Bug 852004 - json arrays representation
json arrays representation
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Pasternak
Oded Ramraz
Depends On:
  Show dependency treegraph
Reported: 2012-08-27 06:02 EDT by Gal Leibovici
Modified: 2014-01-12 19:37 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-27 06:15:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Gal Leibovici 2012-08-27 06:02:44 EDT
In JSON API, representation of multiple similar objects are in arrays form,
is problematic.

For example,in entrypoint /api/hosts:
The XML for options under power_management is:
    <option name="port" value=""/>
    <option name="secure" value="false"/>

but the JSON representation is:
"options" : {
        "options" : [ {
          "name" : "port",
          "value" : ""
        }, {
          "name" : "secure",
          "value" : "false"
        } ]

so options inside powerManagement is an object containing an "options" field which is an array of objects.

I think it should be that options field of powerManagement is an array of objects directly.

This is happening in other locations too, I think the code groups similar xml objects in a single json field with plural form name. in cases where it's the only type of elements, it should be grouped directly.
Comment 1 Michael Pasternak 2012-08-27 06:15:00 EDT
i'm aware of this issue, but this is schema modelling since 2.2
which cannot be changed in sake of backward compatibility

Note You need to log in before you can comment on or make changes to this bug.