Hearth based derivation - WIP - #5514
Kamil-Lontkowski wants to merge 14 commits into
Conversation
d1e4b5b to
c030154
Compare
ReviewThe approach is right and the compile-time goal is met. There are four correctness bugs I'd fix before merging, three of which are schema/codec disagreements — the thing the module exists to prevent. Tests pass: 189 succeeded, 0 failed, 168s ( GoalsFaster derivation — yes, measured. 27 types,
Scaling is linear in fields, types and call sites. Reusing jsoniter — yes for the codec. The schema half is where duplication sits: about 209 of 477 lines overlap tapir core. Roughly half of that is unavoidable (core's Single configuration point — done for names, not for shape. Field names, type names, discriminator field and discriminator values really are computed once and spliced into both halves. Shape is where it leaks; see below. Customisation coverage — the weak spot. Of jsoniter's 31 Bugs to fix before merge1. 2. A user 3. A leaf derived on its own writes a 4. Two leaves with the same simple name: one disappears from the schema, and validation throws. Two more disagreements, lower impact:
That Derivation timeoutThe 5s macro timeout is a build failure that depends on the machine. The documented way out of that does not work. Customisation gapsSchema annotations are fully covered — all 11 are honoured, and
Also inconsistent: a non-literal One asymmetry to decide onA bare For opaque and leaf types both givens are accepted independently and nothing checks them against each other: Performance follow-ups
Smaller ones: With Code that can go — around 250 lines
Visibility: nothing in Tests
The generators never produce Four compile-failure tests use bare One thing was dropped with no replacement: master asserted
Docs
Missing from the migration list:
What's goodComment quality is unusually high for macro code — the One coupling worth guarding: |
Rewrites tapir-json-pickler on Hearth + jsoniter-scala: Schema and JsonValueCodec are derived in one macro expansion from one PicklerConfiguration, with every name computed once and spliced into both halves, so the documentation and the wire format cannot drift. A single Shape classification drives both derivations; SchemaCodecAgreementTest checks the property for generated values of every fixture under every configuration.
Behaviour changes vs. the µPickle-based module: untagged Either; @default is documentation-only(jsoniter does not support default params through config); picklerForMap takes a key parser; wrapper givens removed; PicklerConfiguration must be compile-time evaluable; oneOfUsingField must be complete; no in SNames; recursive types supported; jsoniter-scala-macros becomes a transitive compile dependency. See “Migrating from the µPickle-based pickler” in the docs.