each of my services publishes their schemas under a certain endpoint convention and my clients can consume those (since the schemas often are more complex than what can be represented by swagger)
right we define all our schemas in a shared utility library
i’m more talking about coercing the json response from one of our services into clojure datastructures using a given schema
right now we manually call ring.swagger.schema/coerce! on the json response and pass it the relevant schema
just seemed like something someone might have built a library for
Interesting. What would the library do?
It would be cool if schemas & specs would have symmetric encode & decode, so they could be used over the wire. Spec gets close with this.
Something related: https://github.com/metosin/compojure-api/issues/148 & https://github.com/oliyh/martian
well i’m imagining a wrapper around clj-http that could take a :responses map like you define in your api and automatically coerce the json for you
nice, martian looks close
yeah the problem with using swagger directly is you lose the schema part
the main reason we use coerce! is to convert date/money strings back into joda time/money objects
which swagger can’t represent
If the client can access the some shared schema/spec namespaces, it would be possible to create a martian-style client for schema/spec.
yeah all schema is shared in a utility library
definitely gonna look into martian
yeah i think the main issue with martian is it doesn’t support async yet