diff --git a/examples/ring-spec-swagger/README.md b/examples/ring-spec-swagger/README.md index 3eb99d0c..00c30dca 100644 --- a/examples/ring-spec-swagger/README.md +++ b/examples/ring-spec-swagger/README.md @@ -1,4 +1,4 @@ -# reitit-ring, clojure.spec, swagger +# reitit-ring, clojure.spec, swagger, openapi 3 ## 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 diff --git a/examples/ring-spec-swagger/src/example/server.clj b/examples/ring-spec-swagger/src/example/server.clj index 31ac2bc0..fe0ba885 100644 --- a/examples/ring-spec-swagger/src/example/server.clj +++ b/examples/ring-spec-swagger/src/example/server.clj @@ -1,6 +1,7 @@ (ns example.server (:require [reitit.ring :as ring] [reitit.coercion.spec] + [reitit.openapi :as openapi] [reitit.swagger :as swagger] [reitit.swagger-ui :as swagger-ui] [reitit.ring.coercion :as coercion] @@ -44,9 +45,15 @@ {:get {:no-doc true :swagger {:info {:title "my-api"}} :handler (swagger/create-swagger-handler)}}] + ["/openapi.json" + {:get {:no-doc true + :openapi {:info {:title "my-api" + :description "openapi3-docs with reitit-http" + :version "0.0.1"}} + :handler (openapi/create-openapi-handler)}}] ["/files" - {:swagger {:tags ["files"]}} + {:tags ["files"]} ["/upload" {:post {:summary "upload a file" @@ -67,7 +74,7 @@ (io/resource "reitit.png"))})}}]] ["/math" - {:swagger {:tags ["math"]}} + {:tags ["math"]} ["/plus" {:get {:summary "plus with spec query parameters" @@ -111,6 +118,9 @@ (swagger-ui/create-swagger-ui-handler {:path "/" :config {:validatorUrl nil + :urls [{:name "swagger" :url "swagger.json"} + {:name "openapi" :url "openapi.json"}] + :urls.primaryName "openapi" :operationsSorter "alpha"}}) (ring/create-default-handler)))) diff --git a/examples/ring-spec-swagger/swagger.png b/examples/ring-spec-swagger/swagger.png index 9d5a55b8..e7ba4003 100644 Binary files a/examples/ring-spec-swagger/swagger.png and b/examples/ring-spec-swagger/swagger.png differ