From 68a030c349bcd26b9f99073183c3dd6b1175c7e7 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:29:53 +0100 Subject: [PATCH] Add missing `hashes` field to HDADetailed --- client/src/api/schema/schema.ts | 46 +++++++++++++++++++++++++++++++++ lib/galaxy/schema/schema.py | 41 +++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index ec6f14b6018f..f4fe143bc76c 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -3676,6 +3676,11 @@ export interface components { * @description TODO */ genome_build?: string | null; + /** + * Hashes + * @description The list of hashes associated with this dataset. + */ + hashes?: components["schemas"]["DatasetHash"][] | null; /** * HDA or LDDA * @description Whether this dataset belongs to a history (HDA) or a library (LDDA). @@ -4318,6 +4323,36 @@ export interface components { * @description A list of extra files associated with a dataset. */ DatasetExtraFiles: components["schemas"]["ExtraFileEntry"][]; + /** DatasetHash */ + DatasetHash: { + /** + * Extra Files Path + * @description The path to the extra files used to generate the hash. + */ + extra_files_path?: string | null; + /** + * Hash Function + * @description The hash function used to generate the hash. + */ + hash_function: components["schemas"]["HashFunctionNames"]; + /** + * Hash Value + * @description The hash value. + */ + hash_value: string; + /** + * ID + * @description Encoded ID of the dataset hash. + * @example 0123456789ABCDEF + */ + id: string; + /** + * Model class + * @description The name of the database model class. + * @constant + */ + model_class: "DatasetHash"; + }; /** * DatasetInheritanceChain * @default [] @@ -5924,6 +5959,11 @@ export interface components { * @default ? */ genome_build?: string | null; + /** + * Hashes + * @description The list of hashes associated with this dataset. + */ + hashes: components["schemas"]["DatasetHash"][]; /** * HDA or LDDA * @description Whether this dataset belongs to a history (HDA) or a library (LDDA). @@ -6571,6 +6611,12 @@ export interface components { * @enum {string} */ HashFunctionNameEnum: "MD5" | "SHA-1" | "SHA-256" | "SHA-512"; + /** + * HashFunctionNames + * @description Hash function names that can be used to generate checksums for datasets. + * @enum {string} + */ + HashFunctionNames: "MD5" | "SHA-1" | "SHA-256" | "SHA-512"; /** HdaDestination */ HdaDestination: { /** diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index b1744da86007..a3c1e080f3ab 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -116,6 +116,15 @@ class DatasetCollectionPopulatedState(str, Enum): FAILED = "failed" # some problem populating state, won't be populated +class HashFunctionNames(str, Enum): + """Hash function names that can be used to generate checksums for datasets.""" + + md5 = "MD5" + sha1 = "SHA-1" + sha256 = "SHA-256" + sha512 = "SHA-512" + + # Generic and common Field annotations that can be reused across models RelativeUrlField = Annotated[ @@ -699,6 +708,30 @@ class DatasetValidatedState(str, Enum): OK = "ok" +class DatasetHash(Model): + model_class: Literal["DatasetHash"] = ModelClassField(Literal["DatasetHash"]) + id: EncodedDatabaseIdField = Field( + ..., + title="ID", + description="Encoded ID of the dataset hash.", + ) + hash_function: HashFunctionNames = Field( + ..., + title="Hash Function", + description="The hash function used to generate the hash.", + ) + hash_value: str = Field( + ..., + title="Hash Value", + description="The hash value.", + ) + extra_files_path: Optional[str] = Field( + None, + title="Extra Files Path", + description="The path to the extra files used to generate the hash.", + ) + + class HDADetailed(HDASummary, WithModelClass): """History Dataset Association detailed information.""" @@ -834,6 +867,14 @@ class HDADetailed(HDASummary, WithModelClass): title="Created from basename", description="The basename of the output that produced this dataset.", # TODO: is that correct? ) + hashes: Annotated[ + List[DatasetHash], + Field( + ..., + title="Hashes", + description="The list of hashes associated with this dataset.", + ), + ] class HDAExtended(HDADetailed):