Skip to content

docs(api-only-transcriberj): add a guide to hand-written contract tests - #27

Merged
Arc-E-Tect merged 2 commits into
mainfrom
docs/hand-written-contract-tests-guide
Sep 18, 2026
Merged

Arc-E-Tect merged 2 commits into
mainfrom
docs/hand-written-contract-tests-guide

Conversation

@Arc-E-Tect

@Arc-E-Tect Arc-E-Tect commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

A guide in docs/guides/hand-written-contract-tests/, with an overview, a tutorial, a Claude Code prompt and a Codex prompt, for the contract tests the TranscriberJ cannot generate.

What it covers

  • Where the generated tree stops. Constraints are constants, not checks. Field descriptions are a projection. Some constructs degrade to methods that throw.
  • What you still have when a method refuses: provenance, the operation's path, statuses and content types, constraint constants, and the response side in full.
  • Where hand-written code goes, as a design decision (IMPORTANT box): in the generated package, in the test source set. The package-private members it reaches, ContractJson among them, are regenerated every build and are not a published API.
  • What you own when you write it: the values no generated class holds, and four duties that follow from typing them.
  • How many tests, and why: one contract test per response the contract lists, checking only shape. Every invalid input and business rule goes in behaviour tests, as scenarios.
  • A worked example: a oneOf with inline branches plus a business-rule 422. The hand-written body sits next to the generated constants it draws on, and the assertions use the generated error-response descriptors.
  • When the contract changes underneath: a removed constant breaks compilation at the line; a renamed member is caught only by the hash guard.
  • The remedy: name the branches. The guard fires, and the generated bodies take over.

Verified

Also

An overview, a tutorial and two assistant prompts for the contract tests
the generator cannot write: where the generated tree stops, what is
still there when a method degrades, how to write the missing part by
hand from the generated pieces in the generated package, how to guard
it so it breaks when the contract moves, and why a contract test needs
one example per response the contract lists rather than one per invalid
input. Every snippet is expanded from the worked example in the Library
repository, and every command was run in it.
…d-written code owns prominent

The overview, the tutorial and both prompts now state as a design
decision that hand-written test code goes in the generated package, and
that the package-private members it reaches are not a published API;
and they list what no generated class holds -- the members of a degraded
body, const values, constraints written inline in an inline branch --
and the duties that leaves the project.
@Arc-E-Tect
Arc-E-Tect merged commit e569da7 into main Sep 18, 2026
5 checks passed
@Arc-E-Tect
Arc-E-Tect deleted the docs/hand-written-contract-tests-guide branch September 18, 2026 13:01
Arc-E-Tect added a commit that referenced this pull request Sep 18, 2026
# [0.6.0](api-only-publisher-v0.5.0...api-only-publisher-v0.6.0) (2026-09-18)

### ✨ New and updated features

* **api-only-transcriberj:** resolve descriptions through a project's ResourceBundle ([#21](#21)) ([46a61c6](46a61c6)), closes [#21](#21)

### 🐛 Bug Fixes

* **api-only-transcriberj:** generate a oneOf body the way its branches allow ([#25](#25)) ([e1acbe0](e1acbe0)), closes [#25](#25)
* Integrate refreshVersions plugin for dependency management ([#22](#22)) ([4f9b5b7](4f9b5b7)), closes [#22](#22)
* **api-only-transcriberj:** resolve a description in the locale asked for, not the JVM's ([#23](#23)) ([705b86b](705b86b)), closes [#23](#23)

### 📝 Documentation

* **api-only-transcriberj:** add a guide to description bundles ([#24](#24)) ([e4a6031](e4a6031)), closes [#24](#24)
* **api-only-transcriberj:** add a guide to hand-written contract tests ([#27](#27)) ([e569da7](e569da7)), closes [#27](#27) [#26](#26)
* add a reference on authoring a specification library, and keep versions current ([#28](#28)) ([b8bb842](b8bb842)), closes [#28](#28)
* **api-only-transcriberj:** say where hand-written test code goes and what it owns ([#26](#26)) ([ca36e43](ca36e43)), closes [#26](#26) [#25](#25)
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Arc-E-Tect added a commit that referenced this pull request Sep 18, 2026
## [0.3.4](api-only-transcriberj-v0.3.3...api-only-transcriberj-v0.3.4) (2026-09-18)

### 📝 Documentation

* **api-only-transcriberj:** add a guide to hand-written contract tests ([#27](#27)) ([e569da7](e569da7)), closes [#27](#27) [#26](#26)
* add a reference on authoring a specification library, and keep versions current ([#28](#28)) ([b8bb842](b8bb842)), closes [#28](#28)
* **api-only-transcriberj:** say where hand-written test code goes and what it owns ([#26](#26)) ([ca36e43](ca36e43)), closes [#26](#26) [#25](#25)
* **api-only-publisher:** update README version to 0.6.0 [skip ci] ([6d2bf92](6d2bf92))
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 0.3.4 🎉

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 0.3.3 🎉

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