Skip to content

Make IAssertionContainer public, as an experimental extension point - #693

Merged
ewoutkramer merged 2 commits into
developfrom
feature/public-assertion-container
Oct 1, 2026
Merged

ewoutkramer merged 2 commits into
developfrom
feature/public-assertion-container

Conversation

@ewoutkramer

Copy link
Copy Markdown
Member

Follow-up to #685, which added IAssertionContainer as internal.

Why

Users can write their own building blocks. If one of those holds nested assertions, it has to be able to implement IAssertionContainer. Otherwise a schema rewriter, such as the enterprise advisor framework's, cannot descend into it and leaves everything nested inside unchanged without any warning. That is also why the containers are not a fixed list.

Changes

  • AssertionStepKind, AssertionStep, IAssertionContainer and AssertionContainerExtensions become public.
  • They get the same markings as IValidatable/IGroupValidatable: [Experimental("ExperimentalApi")] ([Obsolete] on netstandard2.1) and EditorBrowsable(Never). The contract can still change while phase 3 of the advisor rework lands.
  • The remarks on the interface now spell out that custom building blocks with nested assertions must implement it.
  • The OSS implementations stay explicit, so the public surface of the existing assertions does not change.
  • 35 entries added to PublicAPI.Unshipped.txt. They are identical for net8.0 and netstandard2.1.

This also lets the enterprise tests use the interface directly, instead of through the reflection adapter they use now.

Verification

Release build of the whole solution is clean. Firely.Fhir.Validation.Tests: 311 passed.

🤖 Generated with Claude Code

Custom building blocks can be defined outside this library, and a container-like
one must be able to implement IAssertionContainer, or schema rewriters (such as the
advisor framework's) silently cannot descend into it. This is also why the set of
containers is not a fixed list.

AssertionStepKind, AssertionStep, IAssertionContainer and AssertionContainerExtensions
become public, marked [Experimental]/EditorBrowsable(Never) like IValidatable and
IGroupValidatable, so the contract can still change while the advisor rework
(phase 3) lands. The OSS implementations stay explicit. The remarks on the interface
now spell out the obligation for custom building blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

AssertionStep publicly permits malformed kind/name combinations that can violate traversal invariants.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Exposes assertion-container traversal as an experimental extension point for custom assertions.

Changes:

  • Makes container contracts and helpers public.
  • Adds experimental annotations, documentation, and API declarations.
File Description
Schema/​IAssertionContainer.cs Publishes the traversal contract and supporting types.
PublicAPI.Unshipped.txt Records the new public API surface.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Firely.Fhir.Validation/Schema/IAssertionContainer.cs Outdated
Now that AssertionStep is public, its positional constructor and init accessors
let callers build malformed steps (a Child without a name, a Member with one).
The constructor is now private and the properties get-only, and the factories
that need a name reject null. default(AssertionStep) is a nameless Member step,
which is valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The public API, safeguards, documentation, tests, and baseline entries are consistent and complete.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@ewoutkramer
ewoutkramer merged commit 05d243c into develop Oct 1, 2026
4 checks passed
@ewoutkramer
ewoutkramer deleted the feature/public-assertion-container branch October 1, 2026 07:45
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