Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Typo in TeamsChannelData _attribute_map, eventType #1777

@gokulav137

Description

@gokulav137

Version

Bot Framework SDK v4 Python

Describe the bug

There is a typo in the _attribute_map of TeamsChannelData causing a validation error. Which in-turn doesn't allow messages to be send by creating a conversation using TeamsChannelData.
Also shouldn't the eventType variable in the TeamsChannelData constructor be event_type.

To Reproduce

Steps to reproduce the behavior:
Run the below python snippet

from botbuilder.schema.teams import TeamsChannelData

teams = TeamsChannelData()

teams.validate()

We will get an error

for attr_name, value in [(attr, getattr(self, attr)) for attr in self._attribute_map]:
AttributeError: 'TeamsChannelData' object has no attribute 'eventType'

Expected behavior

The code snippet should run without any error.

Possible Fix

Change the attribute map in TeamsChannelData (botbuilder-python/libraries/botbuilder-schema/botbuilder/schema/teams/_models_py3.py) from

_attribute_map = {
        "channel": {"key": "channel", "type": "ChannelInfo"},
        "eventType": {"key": "eventType", "type": "str"},
        "team": {"key": "team", "type": "TeamInfo"},
        "notification": {"key": "notification", "type": "NotificationInfo"},
        "tenant": {"key": "tenant", "type": "TenantInfo"},
        "meeting": {"key": "meeting", "type": "TeamsMeetingInfo"},
    }

to

_attribute_map = {
        "channel": {"key": "channel", "type": "ChannelInfo"},
        "event_type": {"key": "eventType", "type": "str"},
        "team": {"key": "team", "type": "TeamInfo"},
        "notification": {"key": "notification", "type": "NotificationInfo"},
        "tenant": {"key": "tenant", "type": "TenantInfo"},
        "meeting": {"key": "meeting", "type": "TeamsMeetingInfo"},
    }

More concisely change the key "eventType" to "event_type" in the _attribute_map dictionary

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.bugIndicates an unexpected problem or an unintended behavior.customer-replied-toIndicates that the team has replied to the issue reported by the customer. Do not delete.customer-reportedIssue is created by anyone that is not a collaborator in the repository.needs-triageThe issue has just been created and it has not been reviewed by the team.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions