Skip to content

Commit

Permalink
Fix pydantic BaseModel conflict
Browse files Browse the repository at this point in the history
Fixes `E   NameError: Field name "fields" shadows a BaseModel attribute; use a different field name with "alias='fields'".
`
  • Loading branch information
mvdbeek authored and nsoranzo committed Nov 17, 2021
1 parent 58efcf0 commit 613377e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,9 +998,10 @@ class CreateNewCollectionPayload(Model):
default=None,
description="The ID of the history that will contain the collection. Required if `instance_type=library`.",
)
fields: Optional[Union[str, List[Dict['str', 'str']]]] = Field(
fields_: Optional[Union[str, List[Dict['str', 'str']]]] = Field(
default=[],
description="List of fields to create for this collection. Set to 'auto' to guess fields from identifiers."
description="List of fields to create for this collection. Set to 'auto' to guess fields from identifiers.",
alias="fields",
)


Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/services/dataset_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def create(self, trans: ProvidesHistoryContext, payload: CreateNewCollectionPayl
:returns: element view of new dataset collection
"""
# TODO: Error handling...
create_params = api_payload_to_create_params(payload.dict(exclude_unset=True))
create_params = api_payload_to_create_params(payload.dict(exclude_unset=True, by_alias=True))
if payload.instance_type == DatasetCollectionInstanceType.history:
if payload.history_id is None:
raise exceptions.RequestParameterInvalidException("Parameter history_id is required.")
Expand Down

0 comments on commit 613377e

Please sign in to comment.