This is wrt to the question. How to wrap one schema inside another for Malli? I have two schema:
(def reading-schema
[:map
[:readingDate :re #"\d{4}-\d{2}-\d{2}"]
[:readingType string?]
[:readingPrecision string?]
[:readingEstimate string?]])
(def readingDetails-schema
[:map
[:readingCode string?]
[:readingNumber string?]
[:readingCheck string?]
[:readings [:vector reading-schema]]])
Now I want to define another schema which wraps these both. The thrird schema :
(def testReading-schema
[:merge
#ref [:readingDetails-schema]
[:map
[:finalDate :re #"\d{4}-\d{2}-\d{2}"]
[:claimedBy string?]
[:sentTo string?]
[:recievedFrom string?]
[:readingDetails [how to add here?>]]]])
I'm trying like this
(def testReading-schema
[:merge
#ref [:readingDetails-schema]
[:map
[:finalDate :re #"\d{4}-\d{2}-\d{2}"]
[:claimedBy string?]
[:sentTo string?]
[:recievedFrom string?]
[:readingDetails #ref [:readingDetails-schema]]]])
true
when validated with the desired schema?