Fork me on GitHub
#ring-swagger
<
2017-02-15
>
daveliepmann10:02:46

I recently added swagger to an existing project and many (but perhaps not all?) responses which had been JSON strings are now #object[java.io.ByteArrayInputStream ...] — is this expected behavior? I'm delving into muuntaja to figure out how to configure it back to the old behavior, but this feels like middleware injection where I didn't expect it.

daveliepmann10:02:03

...that may have been due to :disable-api-middleware? being configured at the top level rather than under :api

ikitommi11:02:08

@daveliepmann you can slurp the response to get the string out.

ikitommi11:02:40

I thought r-m-f also returned always streams? anyway, the ring-spec allows both strings and streams - the adapter streams the response in both cases.

ikitommi11:02:08

there is no configuration for “return strings” currently. But if you really want it, please write an issue out of it.

daveliepmann11:02:16

It ended up being my error (misplacing :disable-api-middleware?). I was primarily concerned with unexpected middleware.

ikitommi11:02:59

ok. I think there is a room for improvement for the mw-bundling - would be nice to have a new (just collecting the routing info for reverse-routing & swagger) top-level route, and the current “batteries included” api would be optional. would help in using with existing compojure apps.

daveliepmann11:02:38

that would be perfect for my use case, yes

ikitommi11:02:36

(root
   (api {:swagger {:data {:info {:title “api1"}}}} ...)
   (api {:swagger {:data {:info {:title “api2"}}}} ...)
   my-existing-routes
   (resources “/” …)))

elahti11:02:13

was there some kind of core.spec support already?

elahti11:02:33

assuming i want to be on the bleeding edge here. just about to start new project.

ikitommi11:02:39

no, there is not. but PRs welcome 😉 planned for 1.2 both the ring-async & intial spec-support.

elahti11:02:16

ok thanks. it would be cool to contribute assuming there is time. i'll at least look into it.

ikitommi11:02:09

lot’s of stuff to do with spec-tools. just bit busy with the customer projects.. but here’s the proposal, minor tweaks to Schema-side and make sweet transition from schema to spec (for those who want to do it): https://gist.github.com/ikitommi/fb3e0200504dd8b635ed7edd0cdbc768

ikitommi11:02:11

@daveliepmann could you write an issue out of the root-thing? would like to collect the requirements, and remember that one.

daveliepmann12:02:21

On ring-swagger, correct? Not compojure-api?

ikitommi12:02:55

compojure-api