Fork me on GitHub
#portkey
<
2018-05-15
>
cgrand10:05:41

(defmethod shape-to-spec “list” [ns [name {{:strs [shape]} “member” :strs [max]}]]
  `(spec/and
     (spec/coll-of ~(keyword ns (aws/dashed shape)) :max-count ~max)
     (spec/conformer identity #(if (sequential? %) % [%])))) ; HAL ❤

cgrand10:05:05

this conformer is a case of protocol leak

cgrand10:05:08

HAL allows to replace single-item lists by just the item

cgrand10:05:40

of course you see that it’s in the “unform” direction

cgrand10:05:16

conform is from edn to payload and unform from payload to edn

cgrand11:05:30

I’d like to get rid of all conforms because I want specs to work first as a clean documentation.

cgrand11:05:01

I don’t want to muddy this with protocol details

cgrand12:05:10

so in gen-api I make provision for some vars (prefixed by ser- deser- req- and resp- followed by a spec name), they are expectd to be populated by functions doing transformations.

cgrand14:05:20

obviously these fns would be protocol-dependent

viesti14:05:53

so for example for rest-xml, xml would be serialed/deserialized with these fns

cgrand15:05:09

maybe not entirely

cgrand15:05:31

the core fn would be rest-xml-call, it could do the generic xml lifting

cgrand15:05:27

req- resp- could work from the request/respoinse maps with parsed bodies

cgrand15:05:52

and ser- deser- do the local transformations

cgrand15:05:36

example of local transformation: turning a <list> tag into an actual list

viesti16:05:15

so while making a call, the data that is fed to say ser-create-function-request would be checked against a spec?

cgrand16:05:29

Yes 1/ call conform or valid 2/ call req<-create-function-request -- it indirectly calls some ser-stuff to performs coercion and small fixes 3/ serialize the body of the request in the *-call fn

viesti16:05:05

thinking about pagination

viesti16:05:53

at least one can grab token from response and use it for next request

baptiste-from-paris19:05:41

hey, @cgrand I am going to look at your wip next monday

baptiste-from-paris19:05:08

did not have the time last few days

viesti19:05:59

hmm master...

viesti19:05:53

I think I've formed some obstacles in form of merge conflicts if thinking of rebasing the wip

cgrand11:05:08

You are too impatient Grasshopper