Open
Conversation
For each schema with bitfield points that have level annotations, emit a static factory method that returns a BitfieldChangeDetector configured with the appropriate property getters and GetLevel calls. The runtime change detection logic lives in the consuming project.
The source generator now emits a change detection factory that references BitfieldChangeDetector<T>, which lives in the consuming project. The test project needs a minimal stub so the generated code compiles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate change detection factory for schemas with leveled bitfields
Summary
(Warning/Error/Emergency). This eliminates the need for consumers to manually wire up tracking for each point — the factory stays in sync with the schema automatically.
the JSON schema itself is unchanged, and generators for other languages (e.g. Python) can implement their own equivalent using the same level annotations. Modspec itself remains self-contained and does not
depend on any specific change detection runtime.
Usage
Consuming C# projects opt in by adding the following to their .csproj:
The consuming project must provide a BitfieldChangeDetector class in the Modspec.Model namespace with a Track method matching the following signature:
Generated output example
For a schema named SomeBms with bitfield points StringErrors1 and StringErrors2 that have level annotations:
Test plan