Reputation: 8214
There are many high-quality HTTP clients and web application (micro-) frameworks available in Rust.
Are there sensible strategies for deriving clients from server specifications (or vice versa) or for building both in parallel while keeping all possible contract constraints (methods, paths, headers, bodies & their serializations) typed and in sync?
The use case is a rather large API surface of an SPA with client and backend both written in Rust. Other clients (also written in Rust) are planned.
Upvotes: 0
Views: 379
Reputation: 117681
The serialization is relatively easy to keep in sync if you stay within the Rust world - make dedicated serialization structs in a crate both server and client refer to.
As for the entire API, the best effort I'm aware of is OpenAPI. There's a bunch of crates that aim to work with it, okapi, paperclip, openapiv3, and probably more if you search around. I haven't used any of them though.
Upvotes: 1