ring-swagger & compojure-api
plamen 2018-01-12T08:42:46.000431Z

Hello Tommi, lot of thanks for the hint and example! The reason I need it is exactly for documentation purposes - it is for a prototype where just by having swagger/api docs and something to play with by asking/getting data is very useful and needs almost no specific UI to show the concepts, especially when the actual tree/path data is pretty wide and deep. I looked at the example and as it says - it provides the dynamic paths, but doesnโ€™t show them to the end user. Probably would be able to call compojure-api.sweet/api with at runtime constructed maps. Hope that route will bring me further.

plamen 2018-01-12T08:51:39.000317Z

But your example provides a very nice way how to achieve it. Thank you again!

ikitommi 2018-01-12T08:56:40.000366Z

if you know the nesting in advance, you can generate the routes with normal for, reduce etc.

mgrbyte 2018-01-12T21:58:33.000458Z

@ikitommi having trouble with c.api making application/edn work as the default format. I've set :formats (-> (m/create) (assoc :default-format "application/edn")) in my app, but i'm getting json formatted data back no matter what. I've been digging around the examples and wiki for a while now, must be missing something obvious - could you point me in the right direction pls?

ikitommi 2018-01-13T19:43:56.000140Z


mgrbyte 2018-01-15T10:43:26.000291Z

@ikitommi thanks very much, that solved it :thumbsup:

mgrbyte 2018-01-15T10:45:44.000217Z

fwiw, I'm using the latest c.api, with spec - decided to make all clients pass EDN as it makes the validation much easier. I was finding that e.g making certain values in maps conform to a namespaced keyword (datomic ident form an enum for example) ...

mgrbyte 2018-01-15T10:46:24.000025Z

was a lot more code to write in order to have a single spec to conform to.

mgrbyte 2018-01-15T10:47:03.000367Z

Perhaps I'm "doing it wrong"? ๐Ÿ™‚

mgrbyte 2018-01-15T10:47:43.000267Z

I'm making good progress with my authz stuff, will try and extract an example repo when I'm done and feedback to the project.

ikitommi 2018-01-15T15:34:26.000239Z

@mgrbyte is there still an issue spec + with namespaces keywords, could you paste an example? looking forward to the authz stuff ๐Ÿ™‚

mgrbyte 2018-01-15T15:35:21.000234Z

No direct issue, other than JSON doesn't natively support keywords, so not sure there's a (direct) coercion path without writing custom code

mgrbyte 2018-01-15T15:36:12.000200Z

e.g clj: {:myms/scheama-attr :a-ns/some-ident} - a client supplying something that maps to this in json?

mgrbyte 2018-01-15T15:38:07.000506Z

In the clojure side of things, want to describe :myns/schema-attr with a spec. This needs to work for both the client and the app itself. could write two specs, but not sure that trumps making the client(s) use EDN.