Skip to content

Instantly share code, notes, and snippets.

@alexanderkiel
Created February 20, 2017 10:03
Show Gist options
  • Save alexanderkiel/81daedb133f7939d0c88ff28dd457442 to your computer and use it in GitHub Desktop.
Save alexanderkiel/81daedb133f7939d0c88ff28dd457442 to your computer and use it in GitHub Desktop.
;; I have the following specs
(s/def ::product-id int?)
(s/def ::amount int?)
(s/def ::price bigdec?)
(s/def ::line-item
(s/keys :req [::product-id ::amount ::price]))
(s/def ::line-items
(s/coll-of ::line-item))
(s/def ::order
(s/keys :req [::line-items]))
;; Now I have a om.next query which skips the ::price
[{::all-orders [{::line-items [::product-id ::amount]}]}]
;; My problem: the orders which are returned by that query
;; are no valid ::order. It's also not sufficient to spec
;; a special order, the problem is in ::line-item where I
;; have to spec also another one.
;; I think, the separation between keysets and attribute
;; types works great for scalar types but not so good for
;; map types, were the keyset is bound to a name
;; (::line-item) which is used in other maps (::order).
;; If one likes to have a different keyset for ::line-item
;; one has to use a new name which bubbles up to all
;; occurences of ::line-item like in ::order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment