Files
zeekayandHanzo Dev 86b2f3dda2 zipdoc: an imported type's fields had no docs, so the plane projected nameless
The extractor paired the type-checked view of a struct (authoritative for names
and tags) with the parsed view (which carries the comments) by matching a byte
OFFSET. That works only for a package this pass loaded from source. A position in
an IMPORTED package comes from export data, whose positions carry the real
filename and line and a synthetic offset — the importer fabricates a file whose
every line is one byte long. So the offsets never matched the moment a type lived
in another package.

Which is every op whose In and Out live in the call plane. Those ops published a
description and ZERO field descriptions: the OpenAPI schema, the CLI flag help
and every generated SDK's field docstrings were all nameless, and nothing failed
because a missing description is not an error.

Match on the LINE, which both views agree on, and disambiguate by type name.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-30 06:28:29 -07:00

26 lines
630 B
Go

// Package crosspkg registers ops whose In and Out are declared in another
// package, and whose handler lives in a third file of this one.
package crosspkg
import (
"context"
"github.com/zap-proto/zip"
"github.com/zap-proto/zip/internal/zipdoc/testdata/plane"
)
//go:generate zipdoc
// Register wires the service.
func Register(app *zip.App) {
zip.Post(app, "/v1/workers", ListWorkers)
}
// ListWorkers returns every worker in the org, newest first.
//
// Example: {"org": "hanzo", "limit": 25}
func ListWorkers(_ context.Context, in *plane.ListIn) (*plane.ListOut, error) {
return &plane.ListOut{Next: in.Org}, nil
}