Skip to content

Commit 8dea32f

Browse files
committed
Fixed simple property rendering (fixes #107)
Simple properties are no longer forced into a string representation and thus retain their original data type (i.e. booleans or numbers). Only exception are all option enums that are converted into their string representation.
1 parent c0cdea6 commit 8dea32f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

webexteamssdk/models/cards/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def __init__(self, data=None, title=None, iconURL=None):
4949
self.iconURL = iconURL
5050

5151
super().__init__(
52-
serializable_properties=['data'],
53-
simple_properties=['title', 'iconURL', 'type'],
52+
serializable_properties=[],
53+
simple_properties=['data', 'title', 'iconURL', 'type'],
5454
)
5555

5656

webexteamssdk/models/cards/adaptive_card_component.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525
import json
26-
26+
import enum
2727

2828
class AdaptiveCardComponent:
2929
"""Base class for all Adaptive Card components.
@@ -63,7 +63,10 @@ def to_dict(self):
6363
property_value = getattr(self, property_name, None)
6464

6565
if property_value is not None:
66-
serialized_data[property_name] = str(property_value)
66+
if isinstance(property_value, enum.Enum):
67+
property_value = str(property_value)
68+
69+
serialized_data[property_name] = property_value
6770

6871
# Recursively serialize sub-components
6972
for property_name in self.serializable_properties:

0 commit comments

Comments
 (0)