Separating API definition and implementation for REST APIs

I'm trying to implement a HTTP REST API and want to separate the API definition from server and client implementations. My goal is to define an "API" crate and have different server implementations for this API.

Rocket offers support to generate an OpenAPI spec for a given server, but this is always bound to having a server implementation as well. In Haskell, Servant, for example, allows specifying the API as a type and then allows anything to implement that.

I think I could also live with being able to auto-generate server code from an OpenAPI specification.
Any pointers here are appreciated!

You could certainly define a crate where each endpoint takes the input as a value and returns the output as a value. Then you can wrap that in a crate with a web server that just calls the API crate.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.