Bug #10935

[API] Empty list turned to null

Added by Peter Amstutz over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Story points:
-

Description

{
  "name": "workflow",
  "state": "Uncommitted",
  "command": ["echo"],
  "container_image": "arvados/jobs",
  "output_path": "/",
  "mounts": {
    "foo": {
      "kind": "json",
      "content": {
        "a": [],
        "b": {}
      }
    }
  }
}
>>> import arvados
>>> api = arvados.api()
>>> import json
>>> f = open("blah.json")
>>> js = json.load(f)
>>> js
{u'name': u'workflow', u'mounts': {u'foo': {u'content': {u'a': [], u'b': {}}, u'kind': u'json'}}, u'state': u'Uncommitted', u'output_path': u'/', u'container_image': u'arvados/jobs', u'command': [u'echo']}
>>> api.container_requests().create(body={"container_request":js}).execute()
{u'command': [u'echo'],
 u'container_count': 0,
 u'container_count_max': 3,
 u'container_image': u'arvados/jobs',
 u'container_uuid': None,
 u'created_at': u'2017-01-19T17:06:42.107923671Z',
 u'cwd': u'.',
 u'description': None,
 u'environment': {},
 u'etag': u'dxdbdb25u2pdpaf6q9upvlhxu',
 u'expires_at': None,
 u'filters': None,
 u'href': u'/container_requests/962eh-xvhdp-riqoa9p44s6whuf',
 u'kind': u'arvados#containerRequest',
 u'log_uuid': None,
 u'modified_at': u'2017-01-19T17:06:42.106385000Z',
 u'modified_by_client_uuid': u'962eh-ozdt8-lm5x8emraox8epg',
 u'modified_by_user_uuid': u'962eh-tpzed-000000000000000',
 u'mounts': {u'foo': {u'content': {u'a': None, u'b': {}}, u'kind': u'json'}},
 u'name': u'workflow',
 u'output_name': None,
 u'output_path': u'/',
 u'output_uuid': None,
 u'owner_uuid': u'962eh-tpzed-000000000000000',
 u'priority': None,
 u'properties': {},
 u'requesting_container_uuid': None,
 u'runtime_constraints': {},
 u'scheduling_parameters': {},
 u'state': u'Uncommitted',
 u'use_existing': True,
 u'uuid': u'962eh-xvhdp-riqoa9p44s6whuf'}

Note in the response: mounts[foo][content][a] is "None" instead of an empty list [].


Related issues

Related to Arvados - Bug #11606: [CWL] [API] empty array submitted as nullResolved05/02/2017

Associated revisions

Revision 80f042be
Added by Peter Amstutz over 4 years ago

Merge branch '10935-noop-munge' closes #10935

History

#1 Updated by Peter Amstutz over 4 years ago

  • Description updated (diff)

#2 Updated by Peter Amstutz over 4 years ago

Added request.raw_post() logging.

Request from Python SDK:

{"container_request": {"name": "workflow", "mounts": {"foo": {"content": {"a": [], "b": {}}, "kind": "json"}}, "state": "Uncommitted", "output_path": "/", "container_image": "arvados/jobs", "command": ["echo"]}}

Request from Ruby SDK:

{"container_request":"{\n  \"name\": \"workflow\",\n  \"state\": \"Uncommitted\",\n  \"command\": [\"echo\"],\n  \"container_image\": \"arvados/jobs\",\n  \"output_p
ath\": \"/\",\n  \"mounts\": {\n    \"foo\": {\n      \"kind\": \"json\",\n      \"content\": {\n        \"a\": [],\n        \"b\": {}\n      }\n    }\n  }\n}\n"}

#3 Updated by Peter Amstutz over 4 years ago

  • Assigned To set to Peter Amstutz
  • Target version set to 2017-02-01 sprint

Branch 10935-noop-munge

#4 Updated by Peter Amstutz over 4 years ago

  • Subject changed from Empty list turned to null to [API] Empty list turned to null
  • Status changed from New to In Progress

#6 Updated by Peter Amstutz over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF