Analyzer::Python::FastAPI
Inherits Analyzer::Python::PythonEngine < Analyzer < FileHelper < Reference < Object
Constants
Constant-only matchers hoisted out of the per-line analyze loops so
they aren't recompiled (Crystal rebuilds an interpolated regex
literal on every evaluation). The .to_s expansion of the
interpolated constants is byte-identical to the previous inline form.
Class methods
Instance methods
Configures the prefix for each router
Finds the parameters for a base model class
Finds parameters in dictionary structures
Infers the type of the parameter based on its default value or type annotation
Best-effort resolver for a non-literal prefix= expression in
include_router(...). Handles two shapes the wild produces:
prefix=API_V1_STR— a top-level constant imported viafrom app.core.config import API_V1_STR. We look up the constant's defining module viaimport_modulesand search it forNAME = "literal".prefix=settings.API_V1_STR— class-attribute access on an imported instance. We look upsettings's module and search it forAPI_V1_STR: str = "literal"(the BaseSettings shape full-stack-fastapi-template uses) orAPI_V1_STR = "literal".
Returns nil when the expression doesn't match either shape or we can't find the underlying file — the caller then falls back to an empty prefix so we never surface raw Python expressions in URLs.
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.