mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
The authorizer and the result hook were given the op as DECLARED: for anything declared on a group, the bare leaf and an id derived from it. So a rule keyed on op.Path governed an address nobody serves — /probe/:id where the route table, the registry and the document all say /v1/crm/probe/:id — and one definition mounted at two prefixes reported a single name for two operations. They now see what the route matched: the composed pattern, and the composed id by the same rule the registry uses, where a declared id is the operation's own name and composition does not get a vote. The concrete address stays off Op, because path parameters are input and the hook is promised the operation and the outcome and never the input; a handler that needs the resolved address asks AddressOf. Co-authored-by: Hanzo Dev <[email protected]>
21 lines
495 B
Go
21 lines
495 B
Go
package zipdoc
|
|
|
|
import "testing"
|
|
|
|
func TestExtract_TwoRawCallsAreBothDocumented(t *testing.T) {
|
|
p := load(t, "twoaddr")
|
|
if len(p.Ops) != 2 {
|
|
var k []string
|
|
for _, o := range p.Ops {
|
|
k = append(k, o.Key())
|
|
}
|
|
t.Fatalf("ops = %d, want 2; got %v", len(p.Ops), k)
|
|
}
|
|
for _, want := range []string{"POST /v1/billing/invoices/:id/reminders", "POST /v1/billing/send-invoice-reminder"} {
|
|
op := opByKey(t, p, want)
|
|
if op.Description == "" {
|
|
t.Errorf("%s has no prose", want)
|
|
}
|
|
}
|
|
}
|