Expand description
Dynamic clap command tree generator from cached OpenAPI specifications.
§Box::leak and 'static lifetimes
Clap requires 'static strings for command and argument names. Since
operation IDs, parameter names, and tag names are determined at runtime
from the OpenAPI spec, we use Box::leak via [to_static_str] to
convert owned Strings into &'static str.
This is the standard pattern for dynamic clap usage and is safe because:
- The CLI binary runs once and exits — leaked memory is reclaimed by the OS.
- Total leaked memory is bounded by the spec size (typically <100KB).
- No long-running process or repeated allocation occurs.
Functions§
- generate_
command_ tree - Generates a dynamic clap command tree from a cached
OpenAPIspecification. - generate_
command_ tree_ with_ flags - Generates a dynamic clap command tree with optional legacy positional parameter syntax.