Skip to content

Commit

Permalink
fix: Use correct default value for empty descriptions
Browse files Browse the repository at this point in the history
Merge pull request #51 from DSD-DBS/fix-description
  • Loading branch information
ewuerger authored Oct 28, 2024
2 parents 950861f + 643531d commit 78d7529
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
6 changes: 2 additions & 4 deletions polarion_rest_api_client/clients/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ def _update(self, to_update: dm.Document | list[dm.Document]):
type=api_models.DocumentsSinglePatchRequestDataAttributesHomePageContentType(
to_update.home_page_content.type
),
value=to_update.home_page_content.value
or oa_types.UNSET,
value=to_update.home_page_content.value or "",
)
if to_update.home_page_content
else oa_types.UNSET
Expand Down Expand Up @@ -211,8 +210,7 @@ def _create(self, items: list[dm.Document]):
type=api_models.DocumentsListPostRequestDataItemAttributesHomePageContentType(
document.home_page_content.type
),
value=document.home_page_content.value
or oa_types.UNSET,
value=document.home_page_content.value or "",
)
if document.home_page_content
else oa_types.UNSET
Expand Down
23 changes: 12 additions & 11 deletions polarion_rest_api_client/clients/work_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,21 @@ def _build_work_item_post_request(
self, work_item: dm.WorkItem
) -> api_models.WorkitemsListPostRequestDataItem:
assert work_item.type is not None
assert work_item.title is not None
assert work_item.description is not None
assert work_item.status is not None

attrs = api_models.WorkitemsListPostRequestDataItemAttributes(
type=work_item.type,
description=api_models.WorkitemsListPostRequestDataItemAttributesDescription( # pylint: disable=line-too-long
type=api_models.WorkitemsListPostRequestDataItemAttributesDescriptionType( # pylint: disable=line-too-long
work_item.description.type
),
value=work_item.description.value or oa_types.UNSET,
description=(
api_models.WorkitemsListPostRequestDataItemAttributesDescription( # pylint: disable=line-too-long
type=api_models.WorkitemsListPostRequestDataItemAttributesDescriptionType( # pylint: disable=line-too-long
work_item.description.type
),
value=work_item.description.value or "",
)
if work_item.description
else oa_types.UNSET
),
status=work_item.status,
title=work_item.title,
status=work_item.status or oa_types.UNSET,
title=work_item.title or oa_types.UNSET,
)

attrs.additional_properties.update(work_item.additional_attributes)
Expand Down Expand Up @@ -356,7 +357,7 @@ def _build_work_item_patch_request(
type=api_models.WorkitemsSinglePatchRequestDataAttributesDescriptionType( # pylint: disable=line-too-long
work_item.description.type
),
value=work_item.description.value or oa_types.UNSET,
value=work_item.description.value or "",
)

if work_item.status is not None:
Expand Down

0 comments on commit 78d7529

Please sign in to comment.