https://github.com/otwieracz/liberator-swagger

liberator-swagger is a Clojure library that bridges the Liberator REST framework with Swagger API documentation. It provides a thin integration layer that lets you annotate Liberator resource definitions with Swagger metadata, then automatically generates a swagger.json specification and serves a Swagger UI from your application. Spec support is provided through spec-tools, so your existing clojure.spec definitions can drive both validation and documentation.

The library works by extending Liberator’s defresource with a :swagger key where you declare per-method metadata: tags, summaries, parameter specs (path, body, query), and response schemas. From these declarations, liberator-swagger builds a complete Swagger object that accurately describes your API. The generated spec and UI are served via helper routes that slot into your existing Compojure route definitions.

A useful convenience feature is automatic error handler generation. By adding a :generate-handler key to a response description, the library will create Liberator handler functions (like :handle-not-found) that return the description text as the response body. This removes the boilerplate of writing repetitive error handlers and keeps the error messages consistent with what the Swagger documentation advertises.