json.go
2.19 KB
-
refactor(json): route JSON helpers through a host-injectable codec · 7bbe85bc
`common/json.go` and `relaykit/relayconvert/kitutil/json.go` were two hard-wired copies of the same encoding/json wrapper, so swapping the JSON engine required editing both modules. - kitutil defines a `Codec` interface with a standard-library default and a `SetCodec` hook, mirroring the existing SetLogging host hook; every kitutil JSON helper and relaykit DTO (un)marshal method goes through it - `common/json.go` forwards to kitutil and injects `hostJSONCodec` from init() so tests run on the same engine as production; swapping the engine now touches only this type in the root module - route the remaining direct encoding/json calls inside relaykit (dto/values.go, responses stream validation) through kitutil - add a codec routing test and a host codec conformance test locking the encoding semantics the DTOs depend on Direct encoding/json call sites in the root module are left for a separate cleanup.
CaIon committed