-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add add_attributes
serializer
#139
base: main
Are you sure you want to change the base?
Conversation
Added `layer` custom field to generic and diagram serializer.
182ce81
to
fa8ffa6
Compare
fa8ffa6
to
ee26a4f
Compare
For now this serializer is only supports adding enum attributes as custom fields.
layer
custom fieldadd_attributes
serializer
942c312
to
53a7186
Compare
53a7186
to
20da2f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review not finished yet, but I wanted to provide you with the first feedback asap
@@ -473,6 +528,7 @@ def _diagram( | |||
uuid_capella=diagram.uuid, | |||
description=polarion_api.HtmlContent(diagram_html), | |||
status="open", | |||
layer=layer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the layer will in the future always be part of a diagram workitem and this is not configurable. I think this is fine, but needs to be communicated as a change in the release notes
) -> polarion_api.TextContent: | ||
value = getattr(element, attribute) | ||
if isinstance(value, enum.Enum): | ||
return polarion_api.TextContent(type="string", value=value.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we return TextContent
for simple strings?
if isinstance(value, enum.Enum): | ||
return polarion_api.TextContent(type="string", value=value.name) | ||
|
||
raise ValueError(f"Unsupported attribute type: {value!r}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be more generic here. We could add an HTML-Flag to the config of an attribute. If this flag is set, we export the value of the attribute as HtmlContent
. If not, we just cast the value to string and use the string
@@ -433,6 +457,7 @@ def __generic_work_item( | |||
uuid_capella=obj.uuid, | |||
description=polarion_api.HtmlContent(value), | |||
status="open", | |||
layer=layer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we would add the layer optional via the add_attributes
serializer as we often already have the layer as part of the work item type
ARCHITECTURE_LAYERS: dict[str, str] = { | ||
"common": "Common", | ||
"oa": "Operational Analysis", | ||
"sa": "System Analysis", | ||
"la": "Logical Architecture", | ||
"pa": "Physical Architecture", | ||
"epbs": "EPBS", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to have this as enum defined in Polarion, wouldn't it? This way we could just post the actual values like oa
to Polarion and there it can be handled including localization.
Added
layer
custom field to generic and diagram serializer.