Tomas Sedovic created DTACLOUD-354:
--------------------------------------

             Summary: Inconsistent collection format in JSON responses
                 Key: DTACLOUD-354
                 URL: https://issues.apache.org/jira/browse/DTACLOUD-354
             Project: DeltaCloud
          Issue Type: Bug
          Components: Server
            Reporter: Tomas Sedovic


Depending on the size of a Deltacloud resource collection (images, keys, 
actions, etc.) the JSON responses are not consistent.

0 images:

Expected: {"images": []}
Actual:  {"images": null}


1 image:

Expected: {"images": [{"id": "img1", "name": "Fedora 19", ...}]}
Actual: {"images": {"image": {"id": "img1", "name": "Fedora 19", ...}}}


more than 1 image:

Expected: {"images": [{"id": "img1", "name": "Fedora 19", ...}, {"id": "img2", 
"name": "Fedora 18", ...}]}
Actual: {"images": {"image": [{"id": "img1", "name": "Fedora 19", ...}, {"id": 
"img2", "name": "Fedora 18", ...}]}}

(note that even when Deltacloud does return an array, the array is under 
"images"/"image" which isn't really ideal semantically)

The current situation make it difficult to write clients that consume the JSON 
API because each client has to check the response if it's null/hash/array 
before using the data.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to