Analyzer::Go::Huma
Inherits Analyzer::Go::GoEngine < Analyzer::Go::GoTestPath < Analyzer < FileHelper < Reference < Object
Huma (https://huma.rocks/) is an OpenAPI-first Go framework
where every operation is registered through
huma.Register(api, huma.Operation{Method: ..., Path: ...}, handler)
The Operation literal carries method/path verbatim, and the
handler's Input struct fields declare parameter shape via
tags (path:"id", query:"limit", header:"X-Auth", plus
a Body field for request bodies). That makes extraction
unusually precise compared to other Go routers.
Constants
The API's default security, set on its OpenAPI document:
cfg.OpenAPI.Security = …, api.OpenAPI().Security = …, or
oapi.Security = … with oapi := api.OpenAPI(). Not op.Security = …
in an operation or group modifier, which sets one operation's.
func labelsList(ctx context.Context, in *labelsListInput) (…); the
input is struct for an inline in *struct {…}.
One precompiled matcher instead of a String#includes? scan per
.go file: includes? runs Rabin-Karp over the whole buffer and
the marker is absent in the overwhelming majority of files in a
polyglot repo, so every one of them pays the full scan. See
Analyzer#content_matches?.
p.Security = … inside a modifier taking p *huma.Operation.
autopatch disabled for an operation by its metadata.
A function taking a huma.Operation parameter, for wrapper detection.
Tags we lift from Input struct fields onto endpoint params.
Crystal recompiles an interpolated regex literal on every evaluation (a full PCRE2 JIT compile) — precompile the fixed tag matchers once at load time instead of per struct field.
[]map[string][]string{{"JWTKeyAuth": {}}, {"APITokenAuth": {}}}: an
OpenAPI security requirement list, three brace levels deep at most.
The servers of the API's document: cfg.Servers = … /
oapi.Servers = …, a literal or a variable holding one.
Huma v2's typed convenience helpers — huma.Get(api, "/path", handler) and friends — register an operation without the verbose
huma.Register(api, huma.Operation{...}, handler) literal. The verb
is the method name; the path is the SECOND argument (the first is
the API/group). Mapped here so the call walker can decode them
alongside huma.Register.
Class methods
Instance methods
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.