mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
routerPrefix promises that an unresolvable router "is an error naming the call, never an assumed empty prefix", and then returned the empty prefix for a group. So a group handed to another function filed its ops at the path after the prefix — an address nothing serves — in the document and the MCP tool alike, which is the silent drop the resolution exists to end. The one shape this hits is a group reached through a parameter: the prefix belongs to the call that made the group, and the call is in another function. The error says so now, rather than leaving the reader to infer it from a path that looks plausible. Co-authored-by: Hanzo Dev <[email protected]>
33 lines
648 B
Go
33 lines
648 B
Go
// Package handoff hands a group to another function, which is the one shape a
|
|
// one-file pass cannot resolve: the prefix belongs to the call that made the
|
|
// group, and the call is somewhere else.
|
|
package handoff
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
// In is the input.
|
|
type In struct {
|
|
A string `json:"a"`
|
|
}
|
|
|
|
// Out is the output.
|
|
type Out struct {
|
|
B string `json:"b"`
|
|
}
|
|
|
|
// H answers.
|
|
func H(ctx context.Context, in *In) (*Out, error) { return &Out{B: in.A}, nil }
|
|
|
|
// Register hands the group across a call.
|
|
func Register(app *zip.App) {
|
|
deeper(app.Group("/v1/thing"))
|
|
}
|
|
|
|
func deeper(g *zip.Group) {
|
|
g.Post("/replay", H)
|
|
}
|