mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
zip is shared protocol infra (the fiber-over-ZAP web framework used by every
Lux/Hanzo/Zoo Go binary — nodes, gateway, cloud, iam, kms, o11y, ai, …), so its
home is the ZAP protocol family (zap-proto/{go,http,zapd,zip}), NOT any one org's
brand namespace. This consolidates the rich framework (formerly hanzoai/zip v0.5.0
— Ctx/Handler/Errorf/Err*/HTTPError, typed handlers, middleware, runtime/extension
loading, openapi, validate, zaprpc) with the real ZAP transport (ListenZAP/
ListenHTTP/Serve over zap-proto/http) into ONE canonical module.
Module path github.com/hanzoai/zip -> github.com/zap-proto/zip. Code identical to
hanzoai/zip v0.5.0; promoted to v1.0.0 as the stable shared-infra framework. The
prior hanzoai/zip lineage is retired — one home, one import path, one way.
Verified: go build/vet/test ./... green; the ZAP round-trip integration test serves
/v1/health over the real ZAP transport (200 + handler JSON).
23 lines
1.1 KiB
Go
23 lines
1.1 KiB
Go
// Package jsonenc is zip's single JSON entry point.
|
|
//
|
|
// All JSON marshalling in zip — c.JSON(), c.Bind().Body(), typed.go's
|
|
// generic In/Out handlers, module.go's extension envelope — goes
|
|
// through Marshal / Unmarshal here. There is no other JSON path.
|
|
//
|
|
// Implementation: two build-tag-gated files swap the body. When the
|
|
// binary is compiled with GOEXPERIMENT=jsonv2, the import resolver
|
|
// can reach the stdlib's encoding/json/v2 package and the v2.go file
|
|
// is selected; otherwise v1.go is selected and we fall back to
|
|
// stdlib encoding/json. Either way callers see Marshal / Unmarshal —
|
|
// no v1/v2 branching in zip's own code.
|
|
//
|
|
// Per HIP-0106 "Wire protocol stack": JSON is the boundary format
|
|
// (ingress → gateway → subsystem handler). Inter-subsystem calls use
|
|
// ZAP-typed Go values. JSON marshalling happens at most once per
|
|
// request, at the subsystem handler boundary, through THIS package.
|
|
//
|
|
// Brand policy: no third-party JSON library is allowed. Stdlib only.
|
|
// goccy/go-json, sonic, jsoniter, and friends are NOT permitted in
|
|
// the Hanzo Go stack — see HIP-0106 canonical Hanzo Go stack.
|
|
package jsonenc
|