Fork me on GitHub
#ring-swagger
<
2017-01-24
>
kennethkalmer11:01:28

I have a need to do multiple restructure-params calls on many routes and I’m hoping someone can help me figure out a clean way. Ideally I would like have a single key to restructure, say :respond-with [Schema] and from that I’d like to set/restructure the :return, :query-params & :body values.

kennethkalmer11:01:37

All the routes in question behave the same way and I want to wrap the route body in a function that can take the results of the route body and then sort/filter/paginate through them… For that I need the query params… And I need to update the return schema because I return metadata on the state of the sort/filter/paginate options

kennethkalmer11:01:01

I tried calling (restructure-params :query-params [{page :- Int 1} …] acc) while restructuring :respond-with and clojure blows up because of the letk syntax and I don’t know how to wrangle that… So I kinda stopped there

ikitommi11:01:43

I think it might be easier to model with a resource. There is a example on https://github.com/metosin/compojure-api/tree/master/examples/reusable-resources

kennethkalmer11:01:50

Thanks for the hint! I’ll have a look and report back 🙂

ikitommi11:01:17

cool. The swagger docs can't keep uo if the models are created at runtime thou. Swagger is for static docs. The simpler example is here: https://github.com/metosin/compojure-api/blob/master/examples/resources/src/example/handler.clj

borkdude18:01:35

Where can I find the docs on what options I can provide to GET, POST, DELETE, etc? I have one path parameter that is an Uuid and I want to provide an example in the swagger UI. Is that possible?

ikitommi19:01:31

If someone has extra time, this would be awesome for documentation: https://github.com/metosin/compojure-api/issues/268