Skip to content

Commit

Permalink
Leave collaboration_id and study_id out of client.task.create() if th…
Browse files Browse the repository at this point in the history
…ey are None

Otherwise, a None value triggers validation errors as these fields should be integers (if present)
  • Loading branch information
bartvanb committed Mar 11, 2024
1 parent 73436f8 commit 98d2a28
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions vantage6-client/vantage6/client/__init__.py
Expand Up @@ -1601,18 +1601,23 @@ def create(
}
)

params = {
"name": name,
"image": image,
"description": description,
"organizations": organization_json_list,
"databases": databases,
}

if collaboration:
params["collaboration_id"] = collaboration
if study:
params["study_id"] = study

return self.parent.request(
"task",
method="post",
json={
"name": name,
"image": image,
"collaboration_id": collaboration,
"study_id": study,
"description": description,
"organizations": organization_json_list,
"databases": databases,
},
json=params,
)

@staticmethod
Expand Down

0 comments on commit 98d2a28

Please sign in to comment.