Fork me on GitHub
#ring-swagger
<
2017-11-08
>
bja15:11:28

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)

nickmbailey17:11:37

right we define all our schemas in a shared utility library

nickmbailey17:11:24

i’m more talking about coercing the json response from one of our services into clojure datastructures using a given schema

nickmbailey17:11:54

right now we manually call ring.swagger.schema/coerce! on the json response and pass it the relevant schema

nickmbailey17:11:05

just seemed like something someone might have built a library for

ikitommi17:11:07

Interesting. What would the library do?

ikitommi17:11:28

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.

nickmbailey17:11:44

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

nickmbailey17:11:19

nice, martian looks close

nickmbailey17:11:07

yeah the problem with using swagger directly is you lose the schema part

nickmbailey17:11:31

the main reason we use coerce! is to convert date/money strings back into joda time/money objects

nickmbailey17:11:50

which swagger can’t represent

ikitommi17:11:59

If the client can access the some shared schema/spec namespaces, it would be possible to create a martian-style client for schema/spec.

nickmbailey17:11:33

yeah all schema is shared in a utility library

nickmbailey17:11:39

definitely gonna look into martian

nickmbailey18:11:43

yeah i think the main issue with martian is it doesn’t support async yet