class Analyzer::Go::Huma

Overview

Huma (https://huma.rocks/) is an OpenAPI-first Go framework where every operation is registered through huma.Register(api, huma.Operation{Method: ..., Path: ...}, handler) The Operation literal carries method/path verbatim, and the handler's Input struct fields declare parameter shape via tags (path:"id", query:"limit", header:"X-Auth", plus a Body field for request bodies). That makes extraction unusually precise compared to other Go routers.

Defined in:

analyzer/analyzers/go/huma.cr

Constant Summary

HTTP_METHOD_CONSTANTS = {"http.MethodGet" => "GET", "http.MethodPost" => "POST", "http.MethodPut" => "PUT", "http.MethodPatch" => "PATCH", "http.MethodDelete" => "DELETE", "http.MethodHead" => "HEAD", "http.MethodOptions" => "OPTIONS", "http.MethodConnect" => "CONNECT", "http.MethodTrace" => "TRACE"}
IMPORT_MARKER = "github.com/danielgtaylor/huma"
PARAM_TAG_KINDS = {"path" => "path", "query" => "query", "header" => "header", "cookie" => "cookie"}

Tags we lift from Input struct fields onto endpoint params.

Instance Method Summary

Instance methods inherited from class Analyzer::Go::GoEngine

add_param_to_endpoint(param : Param, endpoint : Endpoint) add_param_to_endpoint, add_static_path_if_valid(static_path : Hash(String, String), public_dirs : Array(Hash(String, String))) add_static_path_if_valid, collect_package_function_bodies(file_contents : Hash(String, String)) : Hash(String, Hash(String, Noir::GoCalleeExtractor::FunctionBody)) collect_package_function_bodies, collect_package_groups_ts(group_method : String = "Group") : Tuple(Hash(String, Hash(String, String)), Hash(String, String)) collect_package_groups_ts, read_package_file_contents : Hash(String, String) read_package_file_contents, resolve_public_dirs(public_dirs : Array(Hash(String, String))) resolve_public_dirs, resolve_public_dirs_with_glob(public_dirs : Array(Hash(String, String))) resolve_public_dirs_with_glob, ts_function_bodies_for_directory(package_function_bodies : Hash(String, Hash(String, Noir::GoCalleeExtractor::FunctionBody)), dir : String) : Hash(String, Noir::GoCalleeExtractor::FunctionBody) ts_function_bodies_for_directory, ts_groups_for_directory(package_groups : Hash(String, Hash(String, String)), dir : String) : Hash(String, String) ts_groups_for_directory

Class methods inherited from class Analyzer::Go::GoEngine

go_test_file?(path : String) : Bool go_test_file?

Instance methods inherited from class Analyzer

analyze analyze, base_path : String base_path, base_paths : Array(String) base_paths, callees_needed? : Bool callees_needed?, logger : NoirLogger logger, parallel_analyze(channel : Channel(String), &block : String -> Nil) parallel_analyze, read_file_content(path : String) : String read_file_content, result : Array(Endpoint) result, url : String url

Constructor methods inherited from class Analyzer

new(options : Hash(String, YAML::Any)) new

Macros inherited from class Analyzer

define_getter_methods(names) define_getter_methods

Instance methods inherited from module FileHelper

all_files : Array(String) all_files, get_files_by_extension(extension : String) : Array(String) get_files_by_extension, get_files_by_prefix(prefix : String) : Array(String) get_files_by_prefix, get_files_by_prefix_and_extension(prefix : String, extension : String) : Array(String) get_files_by_prefix_and_extension, get_public_dir_files(base_path : String, folder : String) : Array(String) get_public_dir_files, get_public_files(base_path : String, anchors : Array(String) = ["shard.yml", "Gemfile"]) : Array(String) get_public_files, populate_channel_with_files(channel : Channel(String)) populate_channel_with_files, populate_channel_with_filtered_files(channel : Channel(String), extension : String)
populate_channel_with_filtered_files(channel : Channel(String), extensions : Array(String))
populate_channel_with_filtered_files

Instance Method Detail

def analyze #

[View source]