Skip to content

Conversation

@dclaux
Copy link
Member

@dclaux dclaux commented May 7, 2025

Overview

This PR replaces most of the code in the Microsoft.Teams.Cards namespace with auto-generated code. This is follow-up work to this PR for TypeScript. The code is generated by this tool.

The auto-generated code presents the following differences compared to the code it replaces:

  • Some type names are different
  • For now at least the entire auto-generated code lives in one single file. We can always look into splitting it into multiple files in the future.
  • All numbers are typed as float
  • Minimal manually written code remains to introduce nice-to-have classes for Teams-specific Action.Submit data.
  • The generated code relies on the StringEnum and IUnion types from Microsoft.Teams.Common

Note

Because of the nature of C#, some aspects are not 100% accurate such as Column.width which in TypeScript is typed as

type ColumnWidth = "auto" | "streatch" | number | RegEx;

Unfortunately there is no way to represent the RegEx in C#, so the type is hoisted into IUnion<string, float>.

Updating Microsoft.Teams.Cards going forward

  • Navigate to the tool (permanent link coming). The content on that page is dynamically generate every time the page is visited. It 100% matches what is documented, guarantying accuracy and completeness.
  • De-select target apps other than Teams
  • Copy the entire generated code
  • Replace the entirety of the Microsoft.Teams.Card/Core.cs file with that copied content
  • The tool cannot currently be automated - there's no CLI available for it.

@dclaux dclaux requested review from aacebo, heyitsaamir and ryanbliss May 7, 2025 19:25
@aacebo aacebo merged commit b676fc5 into main May 8, 2025
2 checks passed
@aacebo aacebo deleted the dclaux-cards-package-auto-gen branch May 8, 2025 14:14
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 this pull request may close these issues.

3 participants