Fork me on GitHub
#beginners
<
2016-03-28
>
chris11:03:09

You have to declare the externs. Use cljsjs if your lib exists there

stephanb15:03:18

I want to create an API which has a lot of large domain objects (think 20+ attributes each). I was looking into using defrecord and Plumatic's schema. A lot of these attributes are optional though and I'm not sure how to declare default values. Would you create factory functions? Would those than just take normal maps again? Any other options to make it less painful to use this API?

donaldball15:03:12

Merge the incoming data with default data before validating? Possibly have separate schema for the incoming data and the internal data, particularly if you’re leaning on schema coercion for the incoming data.

stephanb15:03:29

thanks, I should maybe not use Plumatic's defrecord macro so I can separate the schemas from the records and be able to validate different subsets of the data

stephanb15:03:01

it has stuff like: "object A has attributes A1, A2, A3. Exactly one of them has to be available and be an Int"