Skip to content

docs: the READMEs show the generated code for OrderId, Email and a closed set - #104

Merged
CaffeinatedCoder merged 1 commit into
release/2.3.0from
docs/generated-code-blocks
Oct 28, 2026
Merged

CaffeinatedCoder merged 1 commit into
release/2.3.0from
docs/generated-code-blocks

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #92

Problem

The READMEs said in words what the generators add. Gaël Fraiteur of Metalama suggested showing the generated code for the simple cases instead (discussion 2305).

Change

  • Root README: a collapsed block with what the generators write for OrderId: the field, the private constructor, Value, From, CompareTo and ToString.
  • Generators README: collapsed blocks for Email (TryFrom, FromKnownGood and Revalidate, each calling Create) and for OrderStatus (the static constructor that names the members, Name, Match).
  • Samples project: sets MetalamaEmitCompilerTransformedFiles.
  • GeneratedCodeBlockTests (conventions): a block marked <!-- not compiled: generated code for {file}, trimmed (GeneratedCodeBlockTests) --> is held to the woven form of that sample file. Every member shown, body included, and every interface in its base list has to be in it.

The blocks are trimmed, not pasted. The woven code is fully qualified, carries attributes on every member and casts on every returned expression, and OrderId alone is about 200 lines. AspectTesting's expected files are no shorter (#93). So both sides are compared in a reading form: no attributes, comments, namespace qualifiers, casts or this., and System.String reads as string. Hence the issue's "what the build emits" holds member by member, after that normalisation.

Tests

  • With a From body changed in the root README, the test fails and prints the shown member beside the generated one.
  • A_member_that_differs_is_found pins the comparison on a fixture: a wrong body, an extra member, and an interface the woven base list lacks.
  • Conventions: 1,516 passed. Samples: 144 passed. Full suite: 18,217 passed.

🤖 Generated with Claude Code

…osed set

Gael Fraiteur of Metalama suggested showing the generated code for the simple cases (metalama/Metalama
discussion 2305). The root README shows what OrderId gets, and the Generators README what Email and
OrderStatus get, each in a collapsed block beside where the page declares it: the field, the private
constructor, Value, From or TryFrom, FromKnownGood and Revalidate, CompareTo and ToString; for the
closed set the static constructor that names the members, Name and Match.

The blocks are trimmed, not pasted. The woven code is fully qualified, puts attributes on every member
and casts on every returned expression: OrderId alone is about 200 lines, and AspectTesting's expected
files are no shorter (spike, #93). So the check compares reading forms. The samples project sets
MetalamaEmitCompilerTransformedFiles, and GeneratedCodeBlockTests (conventions) holds each block marked
<!-- not compiled: generated code for {file}, trimmed (GeneratedCodeBlockTests) --> to the woven form of
that sample file: every member shown, body included, and every interface of its base list, after both
sides lose attributes, comments, namespace qualifiers, casts and this., and System.String reads as
string. A block may leave members out, and says so in a comment.

Seeded: a From body changed in the root README fails, printing the block's member and the generated
one. A_member_that_differs_is_found holds the comparison to a wrong body, an extra member and an
interface the woven base list lacks.

Closes #92

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 2.3.0 milestone Oct 28, 2026
@CaffeinatedCoder CaffeinatedCoder added documentation Improvements or additions to documentation package/generators Affects CodoMetis.TypeKit.Generators area/value-objects Value-object contracts and what the aspects generate for them labels Oct 28, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 4529062 into release/2.3.0 Oct 28, 2026
14 of 15 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the docs/generated-code-blocks branch October 28, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/value-objects Value-object contracts and what the aspects generate for them documentation Improvements or additions to documentation package/generators Affects CodoMetis.TypeKit.Generators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant