metosin / ring-swagger

Swagger Spec for Clojure Web Apps
http://metosin.github.io/ring-swagger/doc/
371 stars 84 forks source link

Caching responses across server starts #134

Closed delitescere closed 6 years ago

delitescere commented 6 years ago

I was playing with Juxt's Edge (yada uses ring-swagger) and noticed that an aborted request on the Swagger UI (which had returned an empty document) would thenceforth always returning an empty document.

The response HTTP status was 304. I cleared the browser cache and then the expected response was returned.

I noted a similar question about it that suggested running this every time the server starts:

com.wordnik.swagger.jaxrs.listing.ApiListingCache.invalidateCache()

Also, it appears to be a non-issue in Swagger UI 3.

ikitommi commented 6 years ago

There is no cache in ring-swagger itself, just a pure function to transform Clojure/EDN data into a Swagger Schema representation. The core you suggested seems to be of the Swagger Java library, but we are not using it, just plain Clojure transformations.

So, I guess it's a bug in the Swagger-ui and by default, edge seems to serve it from webjars. We recommend using the https://github.com/metosin/ring-swagger-ui bundlle, which has the 3+ version bundled.