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:

Out of scope for this first cut: meta-annotations, @Filter, @Produces (response type, not input), @RequestAttribute.

Extended Modules

Defined in:

miniparsers/micronaut_extractor_ts.cr

Constant Summary

FORM_FILE_PARAM_TYPES = Set {"completedfileupload", "streamingfileupload", "completedpart", "partdata"}
HTTP_VERB_ANNOTATIONS = {"Get" => "GET", "Post" => "POST", "Put" => "PUT", "Delete" => "DELETE", "Patch" => "PATCH", "Head" => "HEAD", "Options" => "OPTIONS"}
INJECTED_PARAM_TYPES = Set {"authentication", "httprequest", "httpheaders", "pageable", "principal", "x509authentication", "httpparameters", "cookies", "basicauth"}
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"}
REACTIVE_BODY_WRAPPER_TYPES = Set {"mono", "single", "maybe", "flowable", "observable", "flux", "publisher", "completablefuture", "optional"}

Single-argument reactive/async/optional wrappers that Micronaut unwraps transparently when binding @Body (and implicit-body) parameters — e.g. @Body Mono<Book> book carries the same wire-level fields as @Body Book book. Resolving through these lets DTO expansion see the real element type instead of the wrapper's bare name.

Instance Method Summary

Instance Method Detail

def extract_controller_interface_implementations(source : String) : Array(ControllerInterfaceImplementation) #

[View source]
def extract_controller_interface_implementations_from(root : LibTreeSitter::TSNode, source : String) : Array(ControllerInterfaceImplementation) #

[View source]
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)) #

[View source]
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)) #

[View source]
def extract_routes(source : String, dto_index : Hash(String, Array(TreeSitterJavaParameterExtractor::FieldInfo)) = {} of String => Array(TreeSitterJavaParameterExtractor::FieldInfo), *, include_callees : Bool = false) : Array(Route) #

[View source]