Contract as Code as Contract: Using Rust to Unify Specification and Implementation

preview_player
Показать описание
Adam Leventhal, Oxide Computer Company
David Pacheco, Oxide Computer Company

Your API specification and implementation need to match. A mismatch is a recipe for heartbreak--broken clients, busted docs--and we see it all the time. Ideally we want a single source of truth for all aspects of an API, but too often we’re forced to specify attributes in multiple places which opens the door for “alternative mistruths”. For our rapidly evolving API, we developed a new library in Rust that incorporates OpenAPI, not just as decorations, but as load-bearing mechanisms that fully define the interface, both specification and implementation.

In this session, we’ll discuss methods of keeping specification and implementation in sync; why we developed Dropshot as an OpenAPI-first HTTP API library; and how we used some of the differentiated capabilities of the Rust language to combine code and contract. We will cover some of the properties of Rust that may be unfamiliar to the audience such as derive- and proc-macros and the powerful Rust type system.
Рекомендации по теме
Комментарии
Автор

Looks awesome, kinda like GraphQL for REST

VladyVeselinov
welcome to shbcf.ru