module Noir::TreeSitterKotlinRouteExtractor

Overview

Tree-sitter-backed Kotlin route extractor.

Scope for this first cut: Spring-style annotation routing — class-level @RequestMapping-family annotations composing with method-level mapping annotations. Mirrors TreeSitterJavaRouteExtractor but for Kotlin's distinct AST shape (annotations live in modifiers, functions use function_declaration, primary constructors carry DTO fields, etc.).

Covered:

Not covered yet (follow-ups):

Extended Modules

Defined in:

miniparsers/kotlin_route_extractor_ts.cr

Constant Summary

ANNOTATION_VERBS = {"GetMapping" => "GET", "PostMapping" => "POST", "PutMapping" => "PUT", "DeleteMapping" => "DELETE", "PatchMapping" => "PATCH", "RequestMapping" => nil}

Spring mapping annotation names → HTTP verb. nil means look at the annotation's method = argument. Same table as the Java extractor for consistency.

Instance Method Summary

Instance Method Detail

def extract_routes(source : String, string_constants = Hash(String, String).new) : Array(Route) #

[View source]
def extract_routes_from(root : LibTreeSitter::TSNode, source : String, string_constants = Hash(String, String).new) : Array(Route) #

_from(root, source) — accept a pre-parsed root so the Kotlin Spring analyzer can amortise the parse across multiple extractions on the same file. Tree lifetime is the caller's responsibility.


[View source]
def extract_string_constants(source : String) : Hash(String, String) #

[View source]