Repository navigation
feat(api-only-transcriberj-restdocs): mark generated companions as excluded from coverage - #87
Merged
Merged
Conversation
…cluded from coverage A project that measures coverage of the source set its contract classes are generated into measured the REST Docs companions too -- code nobody wrote, and nobody should have to test. The core's generated classes carry a marker annotation for exactly that; the companions did not, so half the generated tree was still counted. Every companion and the shared RestDocsFields now carry @ExcludeFromJacocoGeneratedCodeCoverage(justification = "Generated by API-Only TranscriberJ"), the same annotation and the same wording as the classes they describe. The emitter ships no new dependency: the TranscriberJ adds sedr-library to the source sets it generates into, and it is the tests here that need it, because they compile the generated code. They also move to TranscriberJ 0.2.0, the version that carries the annotation and generates from a contract's AsyncAPI document.
Arc-E-Tect
added a commit
that referenced
this pull request
Sep 18, 2026
# [0.1.0](api-only-transcriberj-restdocs-v0.0.1...api-only-transcriberj-restdocs-v0.1.0) (2026-09-18) ### ✨ New and updated features * **api-only-transcriberj-restdocs:** mark generated companions as excluded from coverage ([#87](#87)) ([dcace04](dcace04)), closes [#87](#87) ### 📝 Documentation * **api-only-transcriberj-restdocs:** update README version to 0.0.1 [skip ci] ([928d165](928d165))
Owner
Author
|
🎉 This PR is included in version 0.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Owner
Author
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Owner
Author
|
🎉 This PR is included in version 1.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Owner
Author
|
🎉 This PR is included in version 1.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Owner
Author
|
🎉 This PR is included in version 1.0.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
The API-Only TranscriberJ now marks every class it generates with
@ExcludeFromJacocoGeneratedCodeCoverage(justification = "Generated by API-Only TranscriberJ"), so a project that measures coverage of the source set its contract classes land in does not measure code nobody wrote. This emitter's companions were the half of the generated tree that still counted.<Name>Docscompanion and the sharedRestDocsFieldsnow carry the same annotation, with the same wording.com.arc-e-tect.sedr.utils:sedr-libraryto the source sets it generates into; it is the tests here that need it, because they compile the generated code.Why it matters
JaCoCo skips a class annotated with an annotation whose simple name contains
Generatedand that is kept at runtime, andcom.arc-e-tect.jacoco-exclusion-reportlists the justification with every other exclusion. Without this, adopting the generated tree in a project with a strict coverage rule meant weakening that rule — which is the wrong trade for code whose correctness is checked where it is produced.Verified
./gradlew checkpasses: the emitter's tests generate from the reference implementation's user-account contract with TranscriberJ 0.2.0, compile what comes out against Spring REST Docs and the annotation, and call it.