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.
But your example provides a very nice way how to achieve it. Thank you again!
if you know the nesting in advance, you can generate the routes with normal for, reduce etc.
@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 thanks very much, that solved it :thumbsup:
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) ...
was a lot more code to write in order to have a single spec to conform to.
Perhaps I'm "doing it wrong"? ๐
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.
@mgrbyte is there still an issue spec + with namespaces keywords, could you paste an example? looking forward to the authz stuff ๐
No direct issue, other than JSON doesn't natively support keywords, so not sure there's a (direct) coercion path without writing custom code
e.g clj: {:myms/scheama-attr :a-ns/some-ident}
- a client supplying something that maps to this in json?
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.