Fork me on GitHub
#clojure-spec
<
2020-09-29
>
Eugen08:09:04

hi, is there some tooling to generate spec code from XSD schema files ? I would like to validate with clojurescript (if possible) some OFX XML I generate

fadrian14:09:53

I tried both of the XSD parsers I found using Google search (which looks like they came from the same root). Neither of them seemed to work. clj-xml will parse an XSD, but moving on from the parsed XML to a spec seems to still be a work-in-progress.

👍 3
mpenet16:09:45

I have a case where I generate specs, and sometimes I have fwd declarations in spec alises: (s/def ::foo ::bar) where ::bar is not declared/speced yet, so it blows up of course. A dirty way to do that is to do (s/and ::bar) as spec for instance but I am sure there's a better way (short of building a dep graph and specing in order)?

Alex Miller (Clojure team)16:09:07

Forward references are actually intended to be ok in specs - the spec alias case (s/def ::foo ::bar) is one known exception to that (there is a ticket for this)

Alex Miller (Clojure team)16:09:32

not sure if you've tried (s/spec ::bar) - that might also work

Alex Miller (Clojure team)16:09:46

would be slightly less dirty if so

mpenet16:09:21

I tried s/spec, doesn't work

Alex Miller (Clojure team)16:09:44

well, can't say I have a better alternative for you then

mpenet16:09:46

"unable to resolve spec ::bar "

mpenet16:09:08

alright, thanks for the info. If it's a bug I'll take the s/and trick as acceptable for now

mpenet16:09:43

I cannot find the jira for it, but I am not a good at jira'ing