Fork me on GitHub
#ring-swagger
<
2018-01-11
>
ammazza03:01:07

Hello! I'm at my first attempt at using swagger and compojure-api. Is there a (simple) way to get swagger UI to present different documents for different contexts?

ikitommi08:01:30

It depends. You can have multiple apis next to each other with different route trees - and those route trees can share same routes. Also, you can mount multiple swagger-spec endpoints manually and mofidy the resulting specs via a response middleware. But thats not trivial I guess.

ammazza23:01:47

I see... well, it was mostly about making the documentation page tidier. In the meantime I learned about :tags in the contexts, so now at least I have a title for each context and I can hide/show its functions independently.

plamen14:01:58

Hello, is there a way to define a context/resource in compojure-api/swagger with clojure.spec as coercion for URIs of the form /balance-sheet/aggregation1/aggregation2.../aggregationN/value, where the depth N of aggregations is not known in advance?

plamen15:01:09

I know how to do it with the fixed parts of the URI (balance-sheet and value), but no idea if it even possible in the context above without resorting to a custom path definition like /balance-sheet/aggregation1aggregation2aggregationN/value. The problem is that in that scheme, the aggregation path can be parsed independent of compojure-api/spec/swagger, but it is a hack in every possible dimension.

ikitommi19:01:51

@plamen swagger if for static documentation, so I don’t think it can present such for documentation. I think you can do such a thing with compojure thou. There is an example of dynamic routing in https://github.com/metosin/compojure-api/tree/master/examples/reusable-resources. Should be streightforward to port it to spec.

ikitommi19:01:04

hope that helps.