diff --git a/examples/http-swagger/README.md b/examples/http-swagger/README.md index 651e9bab..e5df1cce 100644 --- a/examples/http-swagger/README.md +++ b/examples/http-swagger/README.md @@ -1,4 +1,4 @@ -# Http with Swagger example +# Http with Swagger/OpenAPI example ## Usage @@ -7,6 +7,10 @@ (start) ``` +- Swagger spec served at +- Openapi spec served at +- Swagger UI served at + To test the endpoints using [httpie](https://httpie.org/): ```bash @@ -20,4 +24,4 @@ http GET :3000/async results==1 seed==reitit ## License -Copyright © 2018 Metosin Oy +Copyright © 2018-2023 Metosin Oy diff --git a/examples/http-swagger/src/example/server.clj b/examples/http-swagger/src/example/server.clj index 7bb7f5d6..71aef569 100644 --- a/examples/http-swagger/src/example/server.clj +++ b/examples/http-swagger/src/example/server.clj @@ -4,6 +4,7 @@ [reitit.coercion.spec] [reitit.swagger :as swagger] [reitit.swagger-ui :as swagger-ui] + [reitit.openapi :as openapi] [reitit.http.coercion :as coercion] [reitit.dev.pretty :as pretty] [reitit.interceptor.sieppari :as sieppari] @@ -44,6 +45,14 @@ :swagger {:info {:title "my-api" :description "with reitit-http"}} :handler (swagger/create-swagger-handler)}}] + ["/openapi.json" + {:get {:no-doc true + ;; TODO swagger-ui hasn't released support for OAS 3.1 yet, so we pretend it's 3.0 + :openapi {:openapi "3.0.0" + :info {:title "my-api" + :description "with reitit-http" + :version "0.0.1"}} + :handler (openapi/create-openapi-handler)}}] ["/files" {:swagger {:tags ["files"]}}