The fern-cli-sdk is a Rust-based library and binary template designed to transform API schemas into dynamic Command Line Interfaces (CLIs) at compile time. Instead of a separate code generation step, the schema is embedded directly into the binary using include_str!, parsed at process startup, and used to construct a clap::Command tree in memory.
Supported protocols include:
- OpenAPI: Converts YAML specs to a
RestDescription and clap tree, utilizing Fern's x-fern-* extensions. - GraphQL: Derives the command tree from
Query and Mutation types using introspection JSON. - AsyncAPI: Supports AsyncAPI 2.6 YAML/JSON, focusing on channel/operation models (rejects non-2.6.x versions and non-WebSocket server protocols).
The system is designed for protocol isolation, ensuring customers only receive the specific protocol logic they require (e.g., only OpenAPI or only GraphQL).