module
Noir::TreeSitterMicronautExtractor
Overview
Tree-sitter-backed Micronaut route + parameter extractor.
Walks @Controller-annotated classes and emits one route per
method-level verb annotation. Recognises:
- Class-level
@Controller("/x")— joined onto each method's path with a single/separator. - Class-level
@ServerWebSocket("/x")— surfaced asGETwithprotocol = "ws". - Verb annotations:
@Get,@Post,@Put,@Delete,@Patch,@Head,@Optionsfromio.micronaut.http.annotation. - Path supplied positionally (
@Get("/x")) or via thevalue/uri/uriskeyword. Array forms (uris = {"/a", "/b"}) fan out into one route per path. @Consumes(MediaType.APPLICATION_*)at class or method level — method-level wins. Same form/json detection shape as the Spring + JAX-RS extractors.- Parameter annotations:
@PathVariable(skipped — URL carries it)@QueryValue("name")— query@Header("X-Foo")— header@CookieValue("name")— cookie@Part("name")— multipart form@RequestBean— query bean fields@Body— explicit request body
- Un-annotated, non-primitive parameters — treated as the request body (Micronaut's implicit convention) and expanded against the caller-supplied DTO index.
Out of scope for this first cut: meta-annotations, @Filter,
@Produces (response type, not input), @RequestAttribute.
Extended Modules
Defined in:
miniparsers/micronaut_extractor_ts.crConstant Summary
-
HTTP_VERB_ANNOTATIONS =
{"Get" => "GET", "Post" => "POST", "Put" => "PUT", "Delete" => "DELETE", "Patch" => "PATCH", "Head" => "HEAD", "Options" => "OPTIONS"} -
PARAM_ANNOTATION_FORMAT =
{"QueryValue" => "query", "Header" => "header", "CookieValue" => "cookie", "Part" => "form"} -
PRIMITIVE_TYPES =
Set {"boolean", "byte", "char", "short", "int", "long", "float", "double", "void", "string", "object", "integer", "character"}
Instance Method Summary
- #extract_controller_interface_implementations(source : String) : Array(ControllerInterfaceImplementation)
- #extract_controller_interface_implementations_from(root : LibTreeSitter::TSNode, source : String) : Array(ControllerInterfaceImplementation)
- #extract_interface_routes(source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Hash(String, Array(Route))
- #extract_interface_routes_from(root : LibTreeSitter::TSNode, source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Hash(String, Array(Route))
- #extract_routes(source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Array(Route)
Instance Method Detail
def extract_controller_interface_implementations(source : String) : Array(ControllerInterfaceImplementation)
#
def extract_controller_interface_implementations_from(root : LibTreeSitter::TSNode, source : String) : Array(ControllerInterfaceImplementation)
#
def extract_interface_routes(source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Hash(String, Array(Route))
#
def extract_interface_routes_from(root : LibTreeSitter::TSNode, source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Hash(String, Array(Route))
#
def extract_routes(source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Array(Route)
#