Documentation
¶
Index ¶
Constants ¶
const ( ReasonDynamicPattern = "dynamic_pattern" ReasonOpaqueMiddleware = "opaque_middleware" ReasonCrossPackageModel = "cross_package_model" ReasonComplexTypeArg = "complex_type_arg" ReasonCrossPackageHandler = "cross_package_handler" ReasonOther = "other" )
Reason codes for diagnostics.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RouteRegistrations []RouteSymbol
GenericFunctions []FunctionSymbol
ErrorFunctions []FunctionSymbol
}
Config customizes symbols explored by the parser. Every slice is authoritative.
func DefaultConfig ¶
func DefaultConfig() Config
type Diagnostic ¶
type Diagnostic struct {
File string `json:"file"`
Line int `json:"line"`
Column int `json:"column"`
Reason string `json:"reason"` // dynamic_pattern|opaque_middleware|cross_package_model|complex_type_arg|other
Message string `json:"message"`
OmitsOpenAPI bool `json:"omits_openapi"`
}
Diagnostic is a host-side analysis finding for an incomplete route-like site.
func CheckPackage ¶
func CheckPackage(dir string) ([]Diagnostic, error)
CheckPackage runs analysis and returns diagnostics for undiscoverable route candidates. Non-empty diagnostics mean OpenAPI would omit incomplete candidates.
func CheckPackageWithConfig ¶
func CheckPackageWithConfig(dir string, config Config) ([]Diagnostic, error)
CheckPackageWithConfig runs diagnostics with an authoritative symbol config.
func (Diagnostic) String ¶
func (d Diagnostic) String() string
String formats a diagnostic for CLI output.
type FunctionSymbol ¶
type FunctionSymbol struct{ PackagePath, Name string }
type Handler ¶
type Handler struct {
Form string `json:"form"` // named | inline | struct
Name string `json:"name,omitempty"` // function or type name when known
}
Handler describes how the leaf handler was expressed in source.
type Result ¶
type Result struct {
Routes []Route `json:"routes"`
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}
Result is the structured parse output for a single Go package.
func ParsePackage ¶
ParsePackage analyzes Go sources in dir (same package only) and returns statically discoverable httpbind route IR.
Symbol identity for route registration and httpbind calls is resolved with go/types (host-side only); see rule:go-types-symbol-identity.
func ParsePackageFiles ¶
ParsePackageFiles is like ParsePackage but accepts an explicit file list (used by tests when embedding small snippets). Each path must exist.
func ParsePackageWithConfig ¶
ParsePackageWithConfig analyzes dir with customizable discovery symbols.
type Route ¶
type Route struct {
Method string `json:"method"`
Path string `json:"path"`
Handler Handler `json:"handler"`
Request string `json:"request,omitempty"`
Response string `json:"response,omitempty"`
Stream string `json:"stream,omitempty"` // element type when response is Stream[T]
Errors []string `json:"errors,omitempty"`
SuccessStatuses []int `json:"success_statuses,omitempty"` // 200 from Write, others from WriteStatus
Wrappers WrapperMeta `json:"wrappers"`
}
Route is one statically discovered net/http route registration.
type RouteSymbol ¶
type WrapperMeta ¶
type WrapperMeta struct {
AllowQuerySemicolons bool `json:"allow_query_semicolons"`
MaxRequestBodyBytes *int64 `json:"max_request_body_bytes,omitempty"`
StrippedPrefix string `json:"stripped_prefix,omitempty"`
Timeout string `json:"timeout,omitempty"`
TimeoutMessage string `json:"timeout_message,omitempty"`
}
WrapperMeta holds statically known stdlib wrapper metadata.