Skip to content

'isSubtle' and possibly other boolean cards properties are not handled properly #107

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

Closed
acilate opened this issue Apr 14, 2020 · 4 comments · Fixed by #122
Closed

'isSubtle' and possibly other boolean cards properties are not handled properly #107

acilate opened this issue Apr 14, 2020 · 4 comments · Fixed by #122

Comments

@acilate
Copy link

acilate commented Apr 14, 2020

The 'isSubtle' property on a card TextBlock element, when set to True, is sent as a JSON sting value "True" which is not valid. It must be a boolean value.

@sQu4rks
Copy link
Contributor

sQu4rks commented Apr 14, 2020

Thanks for raising this @acilate. Will have a look into it.

@edkuse
Copy link

edkuse commented Jun 23, 2020

Where are you on a fix for this? This is major bug, module not usable.

@sQu4rks
Copy link
Contributor

sQu4rks commented Jun 24, 2020

@edkuse I hope to have a fix in by the start of the next week. Thanks for your patience.

@sQu4rks
Copy link
Contributor

sQu4rks commented Jun 29, 2020

I just pushed a change that should resolve this issue. A card like this:

from webexteamssdk.models.cards import AdaptiveCard
from webexteamssdk.models.cards.components import TextBlock
from webexteamssdk.models.cards.options import HorizontalAlignment
from webexteamssdk.models.cards.actions import Submit

t = TextBlock("Test text", isSubtle=True, horizontalAlignment=HorizontalAlignment.CENTER)

body = []
body.append(t)

s = Submit(title="Test", data={"hidden": "data"})
actions = [s]

c = AdaptiveCard(body=body, actions=actions)

print(str(c.to_json(indent=4)))

now prints as this (valid) json

{
    "version": "1.1",
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "Test text",
            "horizontalAlignment": "center",
            "isSubtle": true
        }
    ],
    "actions": [
        {
            "data": {
                "hidden": "data"
            },
            "title": "Test",
            "type": "Action.Submit"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}

You can try the code by installing my development branch (pip3 install git+https://github.com/sQu4rks/webexteamssdk@issue-107) or wait until the PR gets merged and a new release gets pushed.

Let me know if this resolves your issue.

cmlccie added a commit that referenced this issue Jul 9, 2020
Fixed simple property rendering (fixes #107)
@cmlccie cmlccie closed this as completed in 8dea32f Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants