Skip to content

feat(api-only-transcriberj-restdocs): mark generated companions as excluded from coverage - #87

Merged
Arc-E-Tect merged 1 commit into
mainfrom
feat/restdocs-coverage-annotation
Sep 18, 2026
Merged

Arc-E-Tect merged 1 commit into
mainfrom
feat/restdocs-coverage-annotation

Conversation

@Arc-E-Tect

Copy link
Copy Markdown
Owner

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.

  • Every <Name>Docs companion and the shared RestDocsFields now carry the same annotation, with the same wording.
  • A test pins it on both kinds.
  • The emitter ships no new dependency. The TranscriberJ adds com.arc-e-tect.sedr.utils:sedr-library to the source sets it generates into; it is the tests here that need it, because they compile the generated code.
  • The tests move to TranscriberJ 0.2.0, the release that carries the annotation and generates from a contract's AsyncAPI document.

Why it matters

JaCoCo skips a class annotated with an annotation whose simple name contains Generated and that is kept at runtime, and com.arc-e-tect.jacoco-exclusion-report lists 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 check passes: 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.

…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
Arc-E-Tect merged commit dcace04 into main Sep 18, 2026
4 checks passed
@Arc-E-Tect
Arc-E-Tect deleted the feat/restdocs-coverage-annotation branch September 18, 2026 05:26
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))
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 0.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant