Skip to content

Docs: show the generated code for the simple cases in the READMEs #92

Closed

Description

@CaffeinatedCoder

The READMEs say what the generators add in words and a list: the constructor, Value, the factories, equality, a JSON converter and so on. Gaël Fraiteur of Metalama suggested, after reading the source in the Show and tell discussion (discussion 2305, his comment), showing the generated code for simple cases in the README. It helps understanding without having to parse much text. Thank you; it is good advice.

Proposal

For OrderId : IValue<Guid> and the Email validated value object, a short block of the real generated code, trimmed to what a reader needs (the field, the constructor, Value, From, TryFrom, FromKnownGood, equality). It goes in the root README and the Generators README, next to where they declare a value object. A collapsed <details> block for the longer one, and one for a closed set, would keep the page short.

Done when

  • The code shown is what a build with MetalamaEmitCompilerTransformedFiles emits for those declarations, and a conventions test fails when a README block no longer matches. (Refined 2026-10-28: the emitted code is fully qualified, with attributes and casts everywhere, so the blocks are trimmed, and GeneratedCodeBlockTests compares each member shown, body included, with the emitted one after both lose attributes, comments, namespace qualifiers, casts and this.. PR docs: the READMEs show the generated code for OrderId, Email and a closed set #104.) The blocks are not compiled code (they repeat a partial declaration), so each says <!-- not compiled: ... --> and ReadmeSampleTests does not cover them.
  • The plain-docs voice is kept: example first, plain words.

Activity

  1. added this to the 2.3.0 milestone on Oct 28, 2026
  2. added
    documentation
    package/generators
    area/value-objects
    on Oct 28, 2026
  3. CaffeinatedCoder commented on Oct 28, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Done in PR #104, merged into release/2.3.0.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/value-objectsdocumentationpackage/generators

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions