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]>
24 lines
850 B
Go
24 lines
850 B
Go
package zipdoc
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// A group handed to another function has a prefix this pass cannot see, and
|
|
// the op's own path is only the part after it. Filing the comment at that
|
|
// partial path puts it under an address nothing serves — which is the silent
|
|
// drop this resolution exists to end — so it is refused and the call is named.
|
|
func TestExtract_AGroupHandedAcrossAFunctionIsRefused(t *testing.T) {
|
|
dir, err := filepath.Abs(filepath.Join("testdata", "handoff"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := Load(dir, nil); err == nil {
|
|
t.Fatal("a group reached through a parameter resolved to the empty prefix, so /v1/thing/replay documented as /replay")
|
|
} else if !strings.Contains(err.Error(), "cannot resolve the path prefix") {
|
|
t.Fatalf("refused for some other reason: %v", err)
|
|
}
|
|
}
|