From ccec683fb5c79b37d98c6d38173de6fbc8ada1d6 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 23 May 2024 10:18:39 +0200 Subject: [PATCH] Add string cast for dbkey / genome_build pydantic v1 would automatically apply the string casting. I've verified that we raise RequestParameterInvlalid for new requests. --- lib/galaxy/managers/datasets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/managers/datasets.py b/lib/galaxy/managers/datasets.py index 612a69989deb..1bbe86ee7021 100644 --- a/lib/galaxy/managers/datasets.py +++ b/lib/galaxy/managers/datasets.py @@ -640,7 +640,8 @@ def add_serializers(self): # 'extended_metadata': self.serialize_extended_metadata, # 'extended_metadata_id': self.serialize_id, # remapped - "genome_build": lambda item, key, **context: item.dbkey, + # TODO: Replace string cast with https://github.com/pydantic/pydantic/pull/9137 on 24.1 + "genome_build": lambda item, key, **context: str(item.dbkey) if item.dbkey is not None else None, # derived (not mapped) attributes "data_type": lambda item, key, **context: f"{item.datatype.__class__.__module__}.{item.datatype.__class__.__name__}", "converted": self.serialize_converted_datasets,