ring-swagger & compojure-api
jdt 2018-06-19T14:18:31.000806Z

Having some difficulty, I want to disable YAML in body-param input. This is a project using compojure-api 1.2.0-alpha4 In my call to compojure.api.sweet/api my options include :formats (dissoc (:formats (:formats compojure.api.api/api-defaults)) "application/x-yaml") to try to get the relevant portions of the muntaaja setup in defaults but the swagger page still accepts yaml inputs and attempts to decode it. Other :formats values, like those in the doc-string of compojure.api.sweet/api, don't work at all and result in runtime exceptions. (The documentation shows :formats [:json-kw :edn :transit-msgpack :transit-json]). Any pointers here?

ikitommi 2018-06-19T14:38:05.000481Z

@dave.tenny the docs-string was fixes just few days ago. I would recommend to update to 2.0.0-alpha20 and use something like :formats (update m/default-formats :formats dissoc "application/x-yaml")

ikitommi 2018-06-19T14:39:23.000874Z

:formats now take either a Muuntaja instance or options.

Andreasp1994 2018-06-19T17:39:09.000112Z

Hey how can I set the content-type header when using compojure api?

Andreasp1994 2018-06-19T17:39:16.000293Z

with swagger.

ikitommi 2018-06-19T17:51:02.000708Z

@andreasp1994 it's normal ring, so for example (content-type (ok "{\"a\": 1}") "application/json") should do it

Andreasp1994 2018-06-19T18:52:32.000753Z


Andreasp1994 2018-06-19T21:04:15.000177Z

Is is possible to use compojure 2 without muutanja ??

Andreasp1994 2018-06-19T21:04:40.000285Z

Or integrating with https://github.com/cognitect/transit-clj