Make payload optional again for create tag API

Before https://github.com/galaxyproject/galaxy/pull/17064 it was
possible to create a tag by simply making a POST request like
`/api/histories/911dde3ddb677bcd/tags/tag1` , this restores the
previous behaviour.

Fix BioBlend test failure:

https://github.com/galaxyproject/bioblend/actions/runs/7094150509/job/19308900670#step:10:3029
This commit is contained in:
Nicola Soranzo
2023-12-07 12:58:47 +00:00
parent 295934b125
commit 71be4875e3
4 changed files with 15 additions and 8 deletions
+4 -4
View File
@@ -6392,7 +6392,7 @@ export interface components {
*/
ItemTagsCreatePayload: {
/** value of the item tag */
value: string;
value?: string;
};
/**
* ItemTagsListResponse
@@ -13796,7 +13796,7 @@ export interface operations {
history_id: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
@@ -15103,7 +15103,7 @@ export interface operations {
tag_name: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
@@ -19862,7 +19862,7 @@ export interface operations {
tag_name: string;
};
};
requestBody: {
requestBody?: {
content: {
"application/json": components["schemas"]["ItemTagsCreatePayload"];
};
+2 -2
View File
@@ -42,7 +42,7 @@ class ItemTagsListResponse(Model):
class ItemTagsCreatePayload(Model):
"""Payload schema for creating an item tag."""
value: str = Field(
Required,
value: Optional[str] = Field(
None,
title="value of the item tag",
)
+3 -1
View File
@@ -72,8 +72,10 @@ class FastAPIItemTags:
trans: ProvidesAppContext = DependsOnTrans,
item_id: DecodedDatabaseIdField = Path(..., title="Item ID", alias=tagged_item_id),
tag_name: str = Path(..., title="Tag Name"),
payload: ItemTagsCreatePayload = Body(...),
payload: ItemTagsCreatePayload = Body(None),
) -> ItemTagsResponse:
if payload is None:
payload = ItemTagsCreatePayload()
return self.manager.create(trans, tagged_item_class, item_id, tag_name, payload)
@router.put(
+6 -1
View File
@@ -1,3 +1,8 @@
from typing import (
Any,
Dict,
)
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
@@ -125,7 +130,7 @@ class TestItemTagsApi(integration_util.IntegrationTestCase):
def _create_valid_tag(self, prefix: str):
url = f"{prefix}/tags/awesometagname"
tag_data = dict(value="awesometagvalue")
tag_data: Dict[str, Any] = {} # Can also be dict(value="awesometagvalue")
response = self._post(url, data=tag_data, json=True)
return response