ring-swagger

ring-swagger & compojure-api
sparkofreason 2019-03-15T15:59:00.016300Z

Using compojure-api 2.0.0-alpha29. The swagger UI shows several options for content type, but switching from application/json does not change the examples to match the format. Is there a way to make this work? If not, how do I restrict content type to be only json?

metametadata 2019-03-15T22:22:36.019400Z

@dave.dixon swagger formats are configurable like so:

(c/api
  {:swagger {,,,
          :data {,,,
                 :produces ["application/transit+json" "application/json" "application/edn"]
                 :consumes ["application/json" "application/edn" "application/transit+json"]}}} ,,,)
I don't recall it ever had any effect on the examples in UI.

sparkofreason 2019-03-15T23:57:28.020200Z

Thanks, that did the trick. The UI here changes the example when content type is changed: http://petstore.swagger.io/#/pet/addPet

1
2019-03-18T11:54:18.020400Z

are you using swagger3/openapi v3?

sparkofreason 2019-03-18T17:44:19.026400Z

Whatever the latest compojure-api does.