Skip to content

Add Composite tree schema validation — DP063/DP064/DP065#219

Merged
Skymly merged 1 commit into
mainfrom
feature/composite-schema-validation
Jul 4, 2026
Merged

Add Composite tree schema validation — DP063/DP064/DP065#219
Skymly merged 1 commit into
mainfrom
feature/composite-schema-validation

Conversation

@Skymly

@Skymly Skymly commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add [CompositeSchema(MaxDepth, MaxNodes)] attribute for contract-level tree structure constraints
  • Add [CompositePart(AllowedChildTypes)] property for per-node child type compatibility enforcement
  • Add DP063 (max depth exceeded, Warning), DP064 (child type not allowed, Error), DP065 (node count exceeded, Warning)
  • All constraints are opt-in — unmarked contracts behave as before, zero breaking changes
  • Zero runtime overhead — all validation in source generator
  • RFC: docs/rfc/CompositeTreeSchemaValidation.md
  • Closes Composite tree schema validation — compile-time max depth / parent-child type compatibility / node count #218

Changes

  • Runtime: CompositeSchemaAttribute.cs (new), CompositePartAttribute.cs + TContract.cs (AllowedChildTypes)
  • Diagnostics: DiagnosticIds.cs + DesignPatternsDiagnosticDescriptors.cs (DP063-DP065)
  • SourceGenerators: CompositePartGenerator.cs (schema extraction, depth computation, type validation, node count)
  • Tests: 10 new generator tests covering all 3 diagnostics + negative cases + forest mode + non-generic attribute
  • Docs: ROADMAP.md, AGENTS.md, RFC

Test plan

  • dotnet build DesignPatterns.slnx -c Release — zero errors, zero warnings
  • dotnet test DesignPatterns.slnx -c Release — 651 tests pass (146 SourceGenerators, 324 Runtime, 80 Analyzers, 71 DI, 14 Autofac, 16 Config/AppSettings)
  • 10 new tests: ReportsDp063MaxDepthExceeded, ReportsDp063NotExceededWhenWithinLimit, ReportsDp063ForestModeComputesPerTree, ReportsDp064ChildTypeNotAllowed, ReportsDp064AllowedWhenTypeInList, ReportsDp064NotCheckedWhenAllowedChildTypesNull, ReportsDp064WithNonGenericAttribute, ReportsDp065NodeCountExceeded, ReportsDp065NotExceededWhenWithinLimit, NoSchemaAttributeNoNewDiagnostics
  • CI passes

@Skymly Skymly merged commit 6ff908d into main Jul 4, 2026
3 checks passed
@Skymly Skymly deleted the feature/composite-schema-validation branch July 4, 2026 05:48
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.

Composite tree schema validation — compile-time max depth / parent-child type compatibility / node count

1 participant