adaptive-card-core
Pure-Rust library for validating, optimizing, and transforming Microsoft Adaptive Cards v1.6.
Deterministic, side-effect-free operations against the official v1.6 JSON Schema. No tokio, no network, no async — just serde_json::Value in, typed reports out.
Features
- Schema validation — official Microsoft v1.6 JSON Schema, embedded at build time
- Accessibility scoring — 0–100 score with rule-by-rule fix hints
- Host compatibility — capability matrix for Teams, Outlook, WebChat, Webex, Viva Connections, Windows
- Card transformation — version downgrade (v1.6 → v1.5 → v1.4 → v1.3) and host adaptation
- Optimization — auto-fix accessibility, flatten redundant containers, modernize action shapes
- Templating — convert literal cards into
${expression}templates with sample data - Data → Card — auto-detect Table / FactSet / List / Chart from data shape
- Knowledge base — curated example library with keyword search
Quick start
[]
= "0.1"
use ;
let card = json!;
let report = validate_card;
assert!;
assert_eq!;
Transforming for a different host
use ;
let card = json!;
let report = transform_card.unwrap;
// Card has been downgraded: version 1.6 -> 1.4 and Action.Execute -> Action.Submit
assert_eq!;
assert_eq!;
Optimizing for accessibility
use ;
let card = json!;
let report = optimize_card;
// Image now has placeholder altText and the card has a `speak` property.
Companion MCP server
For LLM-driven workflows, use adaptive-card-mcp — a binary that exposes every function in this crate as an MCP tool over stdio.
License
MIT — see LICENSE at the workspace root.
The embedded Adaptive Cards v1.6 JSON Schema is sourced from
microsoft/AdaptiveCards under
its MIT license. See data/LICENSE-MICROSOFT.