alux-http-openapi
alux-http-openapi interprets an alux-http program as an
OpenAPI 3.1 document that describes it.
This interpreter does not execute handlers. It reads each endpoint to determine what a caller must
send and what the endpoint returns, so it needs alux-shape shapes
where an executing interpreter needs request extractors.
use HttpProgramExt;
use OpenApiHandlerImpl;
let api = new;
let route = api.compile_http;
let document = api.document;
println!;
An OpenAPI document can be generated only when the program states an operation's name, each
argument's name and source, the shape of every value that crosses the wire, and every status an
endpoint can return. All of this information comes from the same declaration that
alux-http-poem and
alux-http-axum compile, so a document and a running service
cannot describe different surfaces.
The source declaration may write /readings/:id. The OpenAPI interpreter converts that portable
path segment to the /readings/{id} spelling used in the generated document.