-
Notifications
You must be signed in to change notification settings - Fork 6
Make images required for Thumbnail #216
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR makes the images field required for ThumbnailCard by overriding the parent class's optional default. While the field remains nullable (can be explicitly set to None), users must now consciously provide a value rather than relying on an implicit default. The changes update the model definition and all example usage to explicitly specify image data.
Key changes:
- Modified
ThumbnailCardto require explicitimagesfield specification using Pydantic'sField(...) - Updated example code to explicitly construct
ThumbnailCardobjects with image data - Added image data to thumbnail dictionaries in example card creation functions
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/api/src/microsoft/teams/api/models/card/thumbnail_card.py | Overrides images field from BasicCard to make it required (but nullable) using Field(...), forcing explicit specification |
| packages/api/src/microsoft/teams/api/models/attachment/card_attachment.py | Removes trailing comment markers from content_type definitions (whitespace cleanup) |
| examples/message-extensions/src/main.py | Updates import organization, explicitly constructs ThumbnailCard with validation, and changes attachment layout to GRID |
| examples/message-extensions/src/cards.py | Adds explicit images array to thumbnail data dictionaries to satisfy new requirement |
Thumbnails should have images be a required field. Without them, thumbnails scenario don't really work.
Technically it's nullable, so we allow it, but it should be explicitly specified that it's nullable.