Rust workspace for the FerrisKey OpenAPI contract in docs/openai.json. The repository ships two primary artifacts:
crates/ferriskey-sdk: the shared Rust SDK generated and validated from the FerrisKey contractbin/ferriskey-cli: a descriptor-driven CLI that exercises the same SDK runtime path as library consumers
The workspace uses cucumber-rs for acceptance coverage, crate-local tests for the inner TDD loop, and Stoplight Prism as the contract mock for end-to-end verification.
- Contract normalization and generated operation metadata derived from
docs/openai.json - Shared request encoding and response decoding for the entire SDK surface
- A dynamic CLI command tree grouped by API tag and operation
- Prism-backed SDK sweep coverage for all documented operations
- Prism-backed CLI smoke coverage and BDD acceptance scenarios
- Strict format, lint, test, and BDD verification through
just
- Rust toolchain with nightly available for
cargo fmtand clippy checks - Node.js and npm for Stoplight Prism
justfor the workspace command surface
just setup
just format
just lint
just test
just bdd
just test-alljust setup installs the Rust workspace tools and ensures @stoplight/prism-cli is available so the Prism-backed tests and examples can run locally.
bin/ferriskey-cli: CLI binary cratecrates/ferriskey-sdk: reusable SDK cratefeatures/: Gherkin acceptance scenarios executed bycargo test -p ferriskey-sdk --test bdddocs/openai.json: authoritative FerrisKey OpenAPI contracttarget/prism/openai.prism.json: normalized Prism-ready artifact generated from the contract
just format
just lint
just test
just bdd
just test-all
just buildjust testruns the crate and integration test suites, including Prism-backed smoke tests.just bddruns the FerrisKey acceptance scenarios fromfeatures/.just test-allruns both the TDD and BDD layers together.
Top-level commands are generated from API tags and operation descriptors. The CLI takes a required base URL, an optional bearer token, and emits structured JSON.
cargo run -p ferriskey-cli -- \
--base-url http://127.0.0.1:4010 \
auth get-openid-configuration \
--realm-name testExample with a request body:
cargo run -p ferriskey-cli -- \
--base-url http://127.0.0.1:4010 \
--bearer-token example-token \
realm update-realm \
--name test \
--body '{"display_name":"example"}'The --body argument accepts inline JSON or @path/to/file.json.
The CLI supports one-time authentication that saves credentials to ~/.ferriskey-cli/config.toml. Once authenticated, subsequent commands automatically use the saved credentials without needing to specify --base-url or --bearer-token.
Authenticate with a FerrisKey server and save credentials:
cargo run -p ferriskey-cli -- login \
--base-url http://127.0.0.1:8080 \
--username admin \
--password secret \
--realm-name masterThe --realm-name parameter is optional and defaults to master.
After logging in, you can run commands without specifying credentials:
# Credentials are loaded automatically from ~/.ferriskey-cli/config.toml
cargo run -p ferriskey-cli -- realm get-realms --realm-name master
cargo run -p ferriskey-cli -- user get-users --realm-name masterYou can still override saved credentials by providing --base-url or --bearer-token explicitly:
cargo run -p ferriskey-cli -- \
--base-url http://different-server:8080 \
realm get-realms --realm-name masterThe acceptance and integration layers expect Prism to serve the normalized contract artifact. A direct local probe looks like this:
prism mock target/prism/openai.prism.json --host 127.0.0.1 --port 4010 --dynamic
cargo run -p ferriskey-cli -- \
--base-url http://127.0.0.1:4010 \
auth get-openid-configuration \
--realm-name testThe SDK and CLI test suites start Prism automatically when needed, so the normal just test, just bdd, and just test-all flows already cover the contract-backed paths.
- BDD via
features/*.featuredefines the acceptance contract. - Example-based tests cover named SDK and CLI behaviors.
propteststays inside the ordinarycargo testloop for invariant-style checks.- Prism-backed tests validate the SDK and CLI against the normalized contract, not a handwritten mock.
Apache-2.0