Skip to content

Commit 4fca48e

Browse files
committed
Use workflow-style payload in data landing request
Makes it considerably easier for sites that support data landing and workflow requests, and it's also easier to read and validate. Closes #21097
1 parent fcbaf24 commit 4fca48e

File tree

10 files changed

+455
-192
lines changed

10 files changed

+455
-192
lines changed

client-api/src/api-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type DatasetStorageDetails = components["schemas"]["DatasetStorageDetails
2626
export type DatasetCollectionAttributes = components["schemas"]["DatasetCollectionAttributesResult"];
2727
export type ConcreteObjectStoreModel = components["schemas"]["ConcreteObjectStoreModel"];
2828
export type MessageException = components["schemas"]["MessageExceptionModel"];
29-
export type DatasetHash = components["schemas"]["DatasetHash"];
29+
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
3030
export type DatasetSource = components["schemas"]["DatasetSource"];
3131
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];
3232
export type StoreExportPayload = components["schemas"]["StoreExportPayload"];

client/src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export function canMutateHistory(history: AnyHistory): boolean {
308308
return !history.purged && !history.archived;
309309
}
310310

311-
export type DatasetHash = components["schemas"]["DatasetHash"];
311+
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
312312

313313
export type DatasetSource = components["schemas"]["DatasetSource"];
314314
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];

client/src/api/schema/schema.ts

Lines changed: 155 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7400,6 +7400,75 @@ export interface components {
74007400
/** Item Ids */
74017401
item_ids: string[];
74027402
};
7403+
/** CollectionElementCollectionRequestUri */
7404+
CollectionElementCollectionRequestUri: {
7405+
/**
7406+
* Class
7407+
* @constant
7408+
*/
7409+
class: "Collection";
7410+
/** Collection Type */
7411+
collection_type: string;
7412+
/** Elements */
7413+
elements: (
7414+
| components["schemas"]["CollectionElementCollectionRequestUri"]
7415+
| components["schemas"]["CollectionElementDataRequestUri"]
7416+
)[];
7417+
/**
7418+
* Identifier
7419+
* @description A unique identifier for this element within the collection.
7420+
*/
7421+
identifier: string;
7422+
};
7423+
/** CollectionElementDataRequestUri */
7424+
CollectionElementDataRequestUri: {
7425+
/**
7426+
* Class
7427+
* @constant
7428+
*/
7429+
class: "File";
7430+
/** Created From Basename */
7431+
created_from_basename?: string | null;
7432+
/**
7433+
* Dbkey
7434+
* @default ?
7435+
*/
7436+
dbkey: string;
7437+
/**
7438+
* Deferred
7439+
* @default false
7440+
*/
7441+
deferred: boolean;
7442+
/** Ext */
7443+
ext: string;
7444+
/** Hashes */
7445+
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
7446+
/**
7447+
* Identifier
7448+
* @description A unique identifier for this element within the collection.
7449+
*/
7450+
identifier: string;
7451+
/** Info */
7452+
info?: string | null;
7453+
/** Location */
7454+
location: string;
7455+
/** Name */
7456+
name?: string | null;
7457+
/**
7458+
* Space To Tab
7459+
* @default false
7460+
*/
7461+
space_to_tab: boolean;
7462+
/** Src */
7463+
src?: null;
7464+
/** Tags */
7465+
tags?: string[] | null;
7466+
/**
7467+
* To Posix Lines
7468+
* @default false
7469+
*/
7470+
to_posix_lines: boolean;
7471+
};
74037472
/** CollectionElementIdentifier */
74047473
CollectionElementIdentifier: {
74057474
/**
@@ -7976,7 +8045,11 @@ export interface components {
79768045
* @default false
79778046
*/
79788047
public: boolean;
7979-
request_state: components["schemas"]["DataLandingRequestState"];
8048+
/** Request State */
8049+
request_state: (
8050+
| components["schemas"]["FileRequestUri"]
8051+
| components["schemas"]["DataRequestCollectionUri"]
8052+
)[];
79808053
};
79818054
/** CreateEntryPayload */
79828055
CreateEntryPayload: {
@@ -9510,17 +9583,6 @@ export interface components {
95109583
* @enum {string}
95119584
*/
95129585
DataItemSourceType: "hda" | "ldda" | "hdca" | "dce" | "dc";
9513-
/** DataLandingRequestState */
9514-
DataLandingRequestState: {
9515-
/** Targets */
9516-
targets: (
9517-
| components["schemas"]["DataElementsTarget"]
9518-
| components["schemas"]["HdcaDataItemsTarget"]
9519-
| components["schemas"]["DataElementsFromTarget"]
9520-
| components["schemas"]["HdcaDataItemsFromTarget"]
9521-
| components["schemas"]["FtpImportTarget"]
9522-
)[];
9523-
};
95249586
/** DataParameterModel */
95259587
DataParameterModel: {
95269588
/**
@@ -9589,6 +9651,30 @@ export interface components {
95899651
*/
95909652
type: "data";
95919653
};
9654+
/** DataRequestCollectionUri */
9655+
DataRequestCollectionUri: {
9656+
/**
9657+
* @description discriminator enum property added by openapi-typescript
9658+
* @enum {string}
9659+
*/
9660+
class: "Collection";
9661+
/** Collection Type */
9662+
collection_type: string;
9663+
/**
9664+
* Deferred
9665+
* @default false
9666+
*/
9667+
deferred: boolean;
9668+
/** Elements */
9669+
elements: (
9670+
| components["schemas"]["CollectionElementCollectionRequestUri"]
9671+
| components["schemas"]["CollectionElementDataRequestUri"]
9672+
)[];
9673+
/** Name */
9674+
name?: string | null;
9675+
/** Src */
9676+
src?: null;
9677+
};
95929678
/** DatasetAssociationRoles */
95939679
DatasetAssociationRoles: {
95949680
/**
@@ -9666,7 +9752,17 @@ export interface components {
96669752
*/
96679753
DatasetExtraFiles: components["schemas"]["ExtraFileEntry"][];
96689754
/** DatasetHash */
9669-
DatasetHash: {
9755+
"DatasetHash-Input": {
9756+
/**
9757+
* Hash Function
9758+
* @enum {string}
9759+
*/
9760+
hash_function: "MD5" | "SHA-1" | "SHA-256" | "SHA-512";
9761+
/** Hash Value */
9762+
hash_value: string;
9763+
};
9764+
/** DatasetHash */
9765+
"DatasetHash-Output": {
96709766
/**
96719767
* Extra Files Path
96729768
* @description The path to the extra files used to generate the hash.
@@ -11378,6 +11474,50 @@ export interface components {
1137811474
/** visible */
1137911475
visible: boolean;
1138011476
};
11477+
/** FileRequestUri */
11478+
FileRequestUri: {
11479+
/**
11480+
* @description discriminator enum property added by openapi-typescript
11481+
* @enum {string}
11482+
*/
11483+
class: "File";
11484+
/** Created From Basename */
11485+
created_from_basename?: string | null;
11486+
/**
11487+
* Dbkey
11488+
* @default ?
11489+
*/
11490+
dbkey: string;
11491+
/**
11492+
* Deferred
11493+
* @default false
11494+
*/
11495+
deferred: boolean;
11496+
/** Ext */
11497+
ext: string;
11498+
/** Hashes */
11499+
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
11500+
/** Info */
11501+
info?: string | null;
11502+
/** Location */
11503+
location: string;
11504+
/** Name */
11505+
name?: string | null;
11506+
/**
11507+
* Space To Tab
11508+
* @default false
11509+
*/
11510+
space_to_tab: boolean;
11511+
/** Src */
11512+
src?: null;
11513+
/** Tags */
11514+
tags?: string[] | null;
11515+
/**
11516+
* To Posix Lines
11517+
* @default false
11518+
*/
11519+
to_posix_lines: boolean;
11520+
};
1138111521
/** FileSourceTemplateSummaries */
1138211522
FileSourceTemplateSummaries: components["schemas"]["FileSourceTemplateSummary"][];
1138311523
/** FileSourceTemplateSummary */
@@ -12218,7 +12358,7 @@ export interface components {
1221812358
* Hashes
1221912359
* @description The list of hashes associated with this dataset.
1222012360
*/
12221-
hashes?: components["schemas"]["DatasetHash"][] | null;
12361+
hashes?: components["schemas"]["DatasetHash-Output"][] | null;
1222212362
/**
1222312363
* HDA or LDDA
1222412364
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).
@@ -12479,7 +12619,7 @@ export interface components {
1247912619
* Hashes
1248012620
* @description The list of hashes associated with this dataset.
1248112621
*/
12482-
hashes: components["schemas"]["DatasetHash"][];
12622+
hashes: components["schemas"]["DatasetHash-Output"][];
1248312623
/**
1248412624
* HDA or LDDA
1248512625
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).

lib/galaxy/schema/fetch_data.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
)
2828
from galaxy.schema.terms import HelpTerms
2929
from galaxy.schema.types import CoercedStringType
30+
from galaxy.tool_util_models.parameters import FileOrCollectionRequest
3031
from galaxy.util.hash_util import HashFunctionNames
3132

3233
HELP_TERMS = HelpTerms()
@@ -303,14 +304,15 @@ class FetchDataFormPayload(BaseDataPayload):
303304
targets: Union[Json[Targets], Targets]
304305

305306

306-
class DataLandingRequestState(Model):
307-
targets: Targets
307+
FileOrCollectionRequests = list[FileOrCollectionRequest]
308+
309+
FileOrCollectionRequestsAdapter = TypeAdapter(FileOrCollectionRequests)
308310

309311

310312
# Vaguely matches the schema.schema.ToolLandingState but we don't allow data_fetch to be called directly
311313
# via the tool API so we have a more specific model here.
312314
class CreateDataLandingPayload(Model):
313-
request_state: DataLandingRequestState
315+
request_state: FileOrCollectionRequests
314316
client_secret: Optional[str] = None
315317
public: bool = False
316318
origin: Optional[HttpUrl] = None

lib/galaxy/tool_util/client/landing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def generate_claim_url(request: Request) -> Response:
7979
try:
8080
raw_response.raise_for_status()
8181
except Exception:
82-
raise Exception("Request failed: %s", raw_response.text)
82+
raise Exception("Request failed: %s", raw_response.json())
8383
response = raw_response.json()
8484
response_type = "workflow" if template_type == "workflow" else "tool"
8585
url = f"{galaxy_url}/{response_type}_landings/{response['uuid']}"

0 commit comments

Comments
 (0)