docs: TSchema guide is missing Union, TaggedStruct, Literal, Tuple, Boolean, and Struct options
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- documentation
Research direction
Start with docs/content/docs/encoding/tschema.mdx and its existing TSchema examples, then map each missing construct and option to a subsection. Add compiling twoslash examples, explain the Union, Variant, and TaggedStruct CBOR differences, and finish with the requested page structure and best-practices guidance.
Written by the indexing model from the issue text.
Description
Problem
The TSchema guide page at `docs/content/docs/encoding/tschema.mdx` covers basic schemas (ByteArray, Integer, Struct, Variant, Array, Map, UndefinedOr) and codec creation, but is missing documentation for several important constructs and usage areas.
Missing Sections
Union — `TSchema.Union()` is the lower-level primitive that `Variant`, `TaggedStruct`, and other helpers are all built on. It is never documented on its own or explained in terms of when you'd reach for it directly over the helpers.
TaggedStruct — `TSchema.TaggedStruct()` creates discriminated unions with an explicit tag field (`_tag`, `type`, `kind`, `variant`). Auto-detection of tag fields inside `Union` members is a key feature that is not mentioned anywhere in the guide.
Literal — `TSchema.Literal()` for enum-style constructors with no fields. The `LiteralOptions` interface (`index`, `flatInUnion`) is not covered.
Tuple — `TSchema.Tuple()` for fixed-length positional data. No mention in the guide.
Boolean — `TSchema.Boolean` for Plutus-style booleans (Constr 0 = False, Constr 1 = True).
NullOr vs UndefinedOr — The guide only covers `UndefinedOr`. `NullOr` and the decision between them is absent.
Struct options — `flatFields`, `flatInUnion`, and `index` options on `TSchema.Struct()` are undocumented. These are critical for correctly matching Aiken on-chain encoding.
Variant vs Union vs TaggedStruct — No comparison section explaining when to use each and how they differ in CBOR encoding:
- Variant: wrapper-object shape (`{ VerificationKey: { hash } }`) — single-level CBOR
- TaggedStruct: discriminator-field shape (`{ _tag: "Mint", amount }`) — tag stripped in CBOR
- Union: raw position-based — constructor index determines variant
Schema utilities — `compose`, `filter`, `equivalence`, and `is` are exported but absent from the guide.
Acceptance Criteria
- Each missing schema type has its own subsection with description and code example
- A comparison section for Union vs Variant vs TaggedStruct with CBOR encoding differences
- Struct options (`flatFields`, `flatInUnion`, `index`) documented with encoding examples
- All examples use `twoslash` code fences and compile
- Page structure: Overview → Quick Start → Core Concepts → Reference → Best Practices
- Dominant language
- TypeScript
- Stars
- 22
- Forks
- 31
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/evolution-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
IntersectMBO/evolution-sdk#579 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainers usually reply within 1 day
-
dependencies good first issue
Difficulty 1/5 Under an hour Newbie friendliness 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainers usually reply within 1 day
-
bug external-review
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
IntersectMBO/evolution-sdk#530 ·
Maintainers usually reply within 1 day
All issues in IntersectMBO/evolution-sdk
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
tomjn/coilbox-hub#454 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
api: spanner
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
googleapis/google-cloud-node#9513 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
SegmentedControl calls Math.random() during render, breaking Next.js cacheComponents prerenderingOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
mantinedev/mantine#9244 ·
Maintainers usually reply within 8 days