Skip to content

feat: add schema diff with Mermaid visualization - #176

Closed
mathpernias wants to merge 1 commit into
drivendataorg:mainfrom
mathpernias:feat/schema-diff
Closed

mathpernias wants to merge 1 commit into
drivendataorg:mainfrom
mathpernias:feat/schema-diff

Conversation

@mathpernias

Copy link
Copy Markdown

Summary

  • Add schema comparison with erdantic diff
  • Support Markdown, JSON, and Mermaid outputs
  • Detect added, removed, renamed, and changed fields
  • Detect relationship and cardinality changes
  • Add --fail-on-breaking for CI pipelines
  • Add a Mermaid Before/Changes/After visualization

Mermaid Visualization

Capture d'écran 2026-10-17 141915

The attached screenshot shows a simple schema comparison:

  • User.age is a required field addition and is marked as breaking in red.
  • User.nickname is an optional field addition and is marked as non-breaking in blue.
  • The diagram displays the previous state, the change, and the resulting state side by side.

Usage

erdantic diff before_models.py after_models.py --format markdown
erdantic diff before_models.py after_models.py --format json
erdantic diff before_models.py after_models.py --format mermaid
erdantic diff before_models.py after_models.py --fail-on-breaking

Validation

  • Added comparison and renderer tests
  • Added CLI tests
  • 18 passed
  • Verified Mermaid output with a visual example

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.

1 participant