module

Noir::TreeSitterJvmLambdaDslExtractor

Tree-sitter-backed walker for JVM "lambda DSL" routing styles — verb("/path", lambda) plus optional path("/prefix", () -> { ... }) nesting. Same shape powers Javalin (app.get("/x", ctx -> ...)), Spark Java (get("/x", (req, res) -> ...)), and other Sinatra-flavoured Java frameworks.

The walker is configured per framework:

  • verb_methods — method names mapped to HTTP verbs.
  • websocket_methods — method names that declare WebSocket endpoints. These are surfaced as GET routes with protocol = "ws".
  • crud_methods — method names that expand a resource path into GET collection, POST collection, GET item, PATCH item, and DELETE item routes.
  • nest_methods — method names that introduce a path prefix (typically path and any equivalent grouping helper).
  • transparent_methods — method names whose lambda body contributes routes without changing the prefix (Javalin's routes).
  • query_methods / form_methods / header_methods / cookie_methods — lambda-body method calls that yield an input parameter. Each takes the param name from a string argument or, when absent, falls back to surfacing the call's receiver name. Method names alone identify a category — we don't enforce a specific receiver, so framework-overlap mistakes show up as cross-framework noise rather than as missed signals.
  • body_methods — calls that signal a request body without a type clue (Spark's req.body()).
  • body_typed_methods — calls that take a class-literal argument indicating the body type (Javalin's ctx.bodyAsClass(Foo.class)).

Out of scope for this first cut: filter chains, reverse routing, cross-file route registration. Routes scoped under static factory methods are still discovered as long as their lambda body lives in the same file.

Instance methods

extract_routes(source : String, config : Config, *, include_callees : Bool = false) : Array(Route)
Source

Nested types