module
Noir::TreeSitterHelidonSeExtractor
Overview
Tree-sitter-backed walker for Helidon SE's functional routing DSL.
Helidon SE has two route-registration shapes that both have to be covered:
- Inline verb calls directly on a
HttpRouting.Builder/HttpRulesreceiver:routing.get("/x", (req, res) -> ...), chained or nested inside a lambda passed to.routing(...). - Modular services: a class
implements HttpServiceoverridesrouting(HttpRules rules)with its own verb calls, and is mounted elsewhere viasomeBuilder.register("/prefix", new MyService()). The quickstart/example apps published by the Helidon project overwhelmingly use this shape —Maincomposes routing by registering oneHttpServiceper resource, in a totally separate class (often a separate file).
Shape 2 is genuinely cross-class (and often cross-file), so this extractor does not try to resolve the full prefix here. Instead it reports, per file:
routes— every verb call found, tagged with the simple name of its immediately enclosing class (empty prefix).edges— every.register(prefix, new Target())call found, tagged with the enclosing class that issued the call and the (simple) class name of the target service.
The analyzer aggregates routes/edges across every Helidon file
in a project root and resolves the prefix graph there (classes are
matched by simple name, project-root scoped — the same
approximation TreeSitterMicronautExtractor's interface-route
index and TreeSitterJvmLambdaDslExtractor's method-reference
index already make).
Extended Modules
Defined in:
miniparsers/helidon_se_extractor_ts.crConstant Summary
-
COOKIE_ACCESSORS =
Set {"get", "first", "all", "getAll", "contains"} -
EMPTY_CONSTANTS =
{} of String => String -
HEADER_ACCESSORS =
Set {"get", "first", "value", "contains"} -
QUERY_ACCESSORS =
Set {"get", "first", "all", "contains"} -
VERB_METHODS =
{"get" => "GET", "post" => "POST", "put" => "PUT", "delete" => "DELETE", "head" => "HEAD", "options" => "OPTIONS", "patch" => "PATCH", "trace" => "TRACE", "any" => "ANY"} -
Helidon's fluent verb API:
HttpRules/HttpRouting.Builderboth expose the same method names.anymatches every HTTP method — kept as the literal "ANY" verb, same convention as Ring/Compojure/ Pedestal/Wisp/Cowboy in this codebase rather than exploding it into one endpoint per concrete verb.
Instance Method Summary
- #extract(source : String, *, include_callees : Bool = false) : FileResult
-
#normalize_path(path : String) : String
Helidon path-parameter syntax:
{name},{name:regex}(typed / regex-constrained segment) and{+name}(matches multiple path segments).
Instance Method Detail
Helidon path-parameter syntax: {name}, {name:regex} (typed /
regex-constrained segment) and {+name} (matches multiple path
segments). All three name the same logical parameter — normalize
down to the plain {name} the rest of noir (and the shared
path-parameter optimizer pass) expects.