Code to contract to code: making ironclad APIs
summary
Claim: automate API correctness by generate spec from server code with dropshot + schema_rs so CI compares the generated OpenAPI JSON to the repo copy and a GitHub Action opens PRs to update it. Tool built is openapi-to generates a Rust crate (outputs normal source, uses quote crate, runs cargo check/clippy) that makes async functions per endpoint, produces examples, and yields async-stream pagination helpers. It works but websockets lack a standard and generated crates increase compile time.
AI-written summary Β· about
chapters (12)
- 0:00API challenges and solutions
- 4:43API schemas and contracts
- 10:00Manual schema maintenance problems
- 11:01Automating schema generation
- 13:10Schemas in sync with CI
- 14:15API clients importance
- 17:23Code generation for clients
- 18:28Custom API client generator
- 21:35openapi-tor Rust code
- 26:30Enhancing generated code
- 28:20WebSockets and edge cases
- 30:48Custom tooling benefits
related talks
20mOpenAPIspec
45mOpenAPI for Web Developers
31mRustly typed APIs; ... JSON RPC with Rust, Procedural macros and a DSL
59mWrite HTTP APIs
29mRust is the language of the AGI
38mZen And The Art Of Automanually Creating API Documentation - An Inquiry Into Process
33mDynamic Test Generation with OpenAPI 3.0
32mBuilding and Maintaining Rust at Scale
