docs: Improve TypeId reference documentation with mdoc and examples#1189
docs: Improve TypeId reference documentation with mdoc and examples#1189
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the TypeId reference documentation by replacing static “expected output” comments with mdoc-evaluated snippets, adding clearer conceptual sections, and providing runnable Scala example apps to demonstrate TypeId behavior.
Changes:
- Updated
docs/reference/typeid.mdwith mdoc-backed examples, an overview diagram, conceptual comparisons, and instructions for running examples. - Added three new runnable TypeId example apps under
schema-examples/src/main/scala/typeid/. - Introduced a new derivation override example app plus additional repo artifacts (
default.nix,.zio-sbt/.../.last_fetch).
Reviewed changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
docs/reference/typeid.md |
Expanded TypeId reference page with mdoc blocks, new sections, and run instructions. |
schema-examples/src/main/scala/typeid/TypeIdBasicExample.scala |
New runnable example covering derivation and basic TypeId properties. |
schema-examples/src/main/scala/typeid/TypeIdSubtypingExample.scala |
New runnable example demonstrating subtype/supertype checks and variance-aware applied type checks. |
schema-examples/src/main/scala/typeid/TypeIdNormalizationExample.scala |
New runnable example demonstrating alias normalization and erased TypeIds for registries. |
schema-examples/src/main/scala/deriveroverrides/CompleteExample.scala |
New runnable example showing derivation instance override resolution order. |
default.nix |
Adds a Nix dev shell configuration. |
.zio-sbt/github-data/.last_fetch |
Adds a tooling state timestamp file. |
- Fix code blocks to use mdoc evaluation instead of inline result comments - Add Overview section with ASCII diagram showing TypeId's role in ZIO Blocks stack - Add TypeId vs Related Concepts section comparing to ClassTag, Class, TypeTag - Add Running the Examples section with runnable app references - Create TypeIdBasicExample: derivation and property access - Create TypeIdSubtypingExample: inheritance and variance-aware subtyping - Create TypeIdNormalizationExample: type aliases and erased TypeIds - All examples use ShowExpr for self-documenting source+result output - Documentation now compiles with mdoc (0 errors) - All examples run successfully Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Fix TypeId structural type signature: change from case class to sealed trait with AnyKind bound - Fix Deriver trait signature: mark as simplified example and note actual API has additional parameters - Fix TypeId.alias parameterization: use alias type (UserId) instead of underlying type (Long) - Remove accidentally committed files: default.nix, .zio-sbt/ artifacts - These changes address Copilot and khajavi review comments on PR zio#1189 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
Fixed in 790d81d - changed to |
|
Fixed in 790d81d - marked as simplified example with note about actual API having additional parameters ( |
|
Fixed in 790d81d - updated to use |
|
Fixed in 790d81d - removed default.nix and .zio-sbt/ generated files. These were accidentally committed and are not part of the TypeId documentation scope. These changes address feedback from both Copilot and khajavi. |
Summary
Significantly improved the TypeId reference documentation to comply with ZIO Blocks standards:
mdoc:silent+mdocpattern# TypeIdh1 heading (Docusaurus uses frontmatter)schema-examples/src/main/scala/typeid/:TypeIdBasicExample: Basic derivation and property accessTypeIdSubtypingExample: Inheritance relationships and variance-aware subtypingTypeIdNormalizationExample: Type aliases, normalization, and erased TypeIdsAll examples use
ShowExpr.show()for self-documenting output that displays both source code and results.Verification
Test plan
🤖 Generated with Claude Code