From 7defd98808e0b654f90c76cc96bd4520fbe0f270 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Fri, 10 Mar 2023 14:34:05 +0200 Subject: [PATCH] doc: Swagger-UI 5.0.0-alpha.0 has OpenAPI 3.1 support mention in docs, use in http-swagger example --- doc/ring/openapi.md | 2 +- examples/http-swagger/project.clj | 3 ++- examples/http-swagger/src/example/server.clj | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/ring/openapi.md b/doc/ring/openapi.md index 98ee4e71..3a1f5fcf 100644 --- a/doc/ring/openapi.md +++ b/doc/ring/openapi.md @@ -50,4 +50,4 @@ If you need to post-process the generated spec, just wrap the handler with a cus [Swagger-UI](https://github.com/swagger-api/swagger-ui) is a user interface to visualize and interact with the Swagger specification. To make things easy, there is a pre-integrated version of the swagger-ui as a separate module. -As of Swagger-UI 4.17, OpenAPI 3.1 is not yet supported. However, most OpenAPI specs generated by reitit are also OpenAPI 3.0 compatible. You can overwrite the version string in the spec to 3.0.0, and you'll be able to use Swagger-UI. See [the http-swagger example](../../examples/http-swagger). +Note: you need Swagger-UI 5 for OpenAPI 3.1 support. As of 2023-03-10, a v5.0.0-alpha.0 is out. diff --git a/examples/http-swagger/project.clj b/examples/http-swagger/project.clj index 6676368e..47b8c500 100644 --- a/examples/http-swagger/project.clj +++ b/examples/http-swagger/project.clj @@ -3,5 +3,6 @@ :dependencies [[org.clojure/clojure "1.10.0"] [ring/ring-jetty-adapter "1.7.1"] [aleph "0.4.7-alpha5"] - [metosin/reitit "0.6.0"]] + [metosin/reitit "0.6.0"] + [metosin/ring-swagger-ui "5.0.0-alpha.0"]] :repl-options {:init-ns example.server}) diff --git a/examples/http-swagger/src/example/server.clj b/examples/http-swagger/src/example/server.clj index 71aef569..711dc270 100644 --- a/examples/http-swagger/src/example/server.clj +++ b/examples/http-swagger/src/example/server.clj @@ -47,9 +47,7 @@ :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" + :openapi {:info {:title "my-api" :description "with reitit-http" :version "0.0.1"}} :handler (openapi/create-openapi-handler)}}]