class EndpointOptimizer
- EndpointOptimizer
- Reference
- Object
Overview
Endpoint optimization module that handles endpoint deduplication, URL combination, and path parameter extraction
Direct Known Subclasses
Defined in:
optimizer/optimizer.crConstructors
Instance Method Summary
-
#add_path_parameters(endpoints : Array(Endpoint)) : Array(Endpoint)
Add path parameters by parsing URL patterns
-
#apply_pvalue(param_type, param_name, param_value) : String
Apply parameter values based on configuration
-
#combine_url_and_endpoints(endpoints : Array(Endpoint)) : Array(Endpoint)
Combine target URL with endpoints
-
#normalize_url_shapes(endpoints : Array(Endpoint)) : Array(Endpoint)
Normalize cross-framework URL shapes the analyzers can't always resolve without language context.
-
#optimize(endpoints : Array(Endpoint)) : Array(Endpoint)
Main optimization workflow - calls all optimization steps
-
#optimize_endpoints(endpoints : Array(Endpoint)) : Array(Endpoint)
Remove duplicated endpoints and parameters, validate HTTP methods, clean URLs
Constructor Detail
Instance Method Detail
Add path parameters by parsing URL patterns
Apply parameter values based on configuration
Combine target URL with endpoints
Normalize cross-framework URL shapes the analyzers can't always
resolve without language context. Rewrites a small set of well-
known leaky forms into the canonical {name} placeholder so the
downstream #add_path_parameters pass picks them up as path
params instead of literal noise.
Covered shapes:
(?P<name>pattern)— Pythonre_path-style named groups. Bleeds through Django'sre_pathroute table; rewrite to{name}and drop the regex body.${name}/${obj.field}— JS/TS template literals that analyzers can't statically resolve (handler files reference captured variables, not literal paths). Rewrite to{name}(or{field}for${obj.field}) so the AI/output payload surfaces it as a path placeholder rather than as a literal${...}segment.- Python regex anchors
^(leading) and$/\Z(trailing) —re_pathpatterns commonly include these. - Python regex backslash-escaped dots
\.— rewrite to plain.for the visible URL. - Spring
{name:regex}— strip the inline regex constraint so the placeholder is{name}regardless of framework dialect.
Main optimization workflow - calls all optimization steps
Remove duplicated endpoints and parameters, validate HTTP methods, clean URLs