Fork me on GitHub
#ring-swagger
<
2016-06-14
>
udit11:06:10

Hey folks! I am using swagger for mostly documenting my APIs. I have turned off the coercion using the :coercion tag. However I am running into problems with APIs that have caching enabled.

udit11:06:30

These cache enabled APIs return a response code of 304 with no body, but apparently swagger doesn’t allow non empty body response for my configuration. Any pointers?

ikitommi12:06:21

@udit: hi, you can define the response to be s/Any. Something like :responses {200 {:schema Response}, 304 {:schema s/Any}}

ikitommi13:06:53

Pushed out ring-swagger 0.22.9. Updated to ring 1.5.0 & some small fixes for nil handling & schema meta-data - https://github.com/metosin/ring-swagger/blob/master/CHANGELOG.md#0229-1462016

ikitommi13:06:47

pushed also new version of compojure-api, just with fresh dependencies (ring 1.5.0, ring-http-response 0.7.0 & the new ring-swagger)

yenda14:06:32

is there a simple way to make ring-swagger work with records for coercion ?

yenda14:06:49

atm I have to define my schemas with s/defschema then convert into records but schema also has s/defrecord

udit14:06:55

Hi @ikitommi. I wanted to know is there a way to include plain compojure routes (declared by compojure.core/defroutes) into the compojure.api.routes.Route

udit14:06:08

Nevermind I got it from the issues list -> https://github.com/metosin/compojure-api/issues/48 Thanks! @ikitommi

juhoteperi14:06:45

@udit: That has changed since then, you can now just directly put those plain compojure routes into c-api defroutes

juhoteperi14:06:34

Though then c-api will warn you that the routes are undocumented, but you can wrap them with undocumented to remove the warning: https://github.com/metosin/compojure-api/blob/master/src/compojure/api/core.clj#L32

udit14:06:13

@juhoteperi: is there an example for the same that I can refer?

shem15:06:34

any rough ETA for spec conformance? weeks,months, years?

ikitommi15:06:41

@shem: I'd say months (= after vacations). Many ways to conform... Did a spike on coverting specs into Schemas, works for simple cases and could give best of both worlds: proven and fast coercions, non-breaking contracts with existing clients.

ikitommi15:06:25

contributions to pure spec version welcome!

shem15:06:22

ok, good to know. not really competent enough to contribute at this point but i'll go ahead with schema with a new project and then convert when spec support comes along. would be nice to help of course. i'll keep an eye on the effort and help if there's something i might manage.