Skip to content

Add an extensible ordered D2 model - #7

Merged
Stephanvs merged 3 commits into
mainfrom
feature/extensible-model
Aug 9, 2026
Merged

Add an extensible ordered D2 model#7
Stephanvs merged 3 commits into
mainfrom
feature/extensible-model

Conversation

@Stephanvs

Copy link
Copy Markdown
Owner

What changed

  • introduces an ordered D2Statement document abstraction
  • adds safe generic scalar/block properties and multiline comments
  • adds an explicitly named D2RawStatement escape hatch
  • preserves mixed insertion order in diagrams, shapes, and connections
  • supports connection property blocks such as style, link, and tooltip
  • models layers, scenarios, and steps with nested boards
  • materializes input enumerables and exposes read-only statement collections

Why

Modern D2 features need an extensible representation that does not require a new constructor parameter for every language addition. Ordering is also semantically significant for sequence diagrams.

Validation

  • dotnet test: 24/24 passed
  • parser-backed d2 validate: passed
  • C# 10 / netstandard2.0 compatibility checked with the package branch's IsExternalInit shim
  • git diff --check: passed

Stack dependency

This PR intentionally targets feature/serialization-safety and contains only one additional commit. Merge PR #4 first, then retarget this PR to main.

Base automatically changed from feature/serialization-safety to main August 9, 2026 10:40
@Stephanvs
Stephanvs marked this pull request as ready for review August 9, 2026 10:47
# Conflicts:
#	src/D2Connection.cs
#	src/D2Shape.cs
#	src/D2Writer.cs
@Stephanvs
Stephanvs merged commit 5e0b96d into main Aug 9, 2026
3 checks passed
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