I want to use a user defined regex pattern for defining dates in edn file, for validation with malli. How do i define this pattern in core.clojure, so that I can use it in the edn file.
This is how my edn file was before.
(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]]])
But I am not able to load this to core.clj. How to resolve this? One way is to define in clojure. But I'm not aware of how to do it.
Let's say this is how I define my /edn file for all the schemas to be at one place.
{
:reading-schema [:map
[:readingDate :re #"\d{4}-\d{2}-\d{2}"]
[:readingType string?]
[:readingPrecision string?]
[:readingEstimate string?]]
:readingDetails-schema [:map
[:readingCode string?]
[:readingNumber string?]
[:readingCheck string?]
[:readings [:vector reading-schema]]]
}
In core.clj, I'm calling it using aero library which is used by malli to call any edn file.
Edit: This is the error I'm facing:
Execution error at aero.core/read-pr-into-tagged-literal (core.cljc:180).
No dispatch macro for: "