Hi!
Can you please elaborate on the problem you are trying to solve? I notice
a couple potential problems in your post, but it's difficult to provide
helpful suggestions because you don't show the actual code you're running
(for instance, the data you show appears to be in JSON and not Clojure
format, and you don't say how you're parsing it):
- As mentioned in the SO reply, are you keywordizing keys when parsing
JSON into Clojure? If not, {"foo" 1} and {:foo 1} are different in Clojure
(and to schematize the former, you would use {(s/required-key "foo")
s/Int}, not {:foo s/Int}.
- The only map with a :type key in your example data has associated value
"string", not "mytype1", so it wouldn't match either of your conditions
- You're actually trying to match one level up `{"mytype1":{"type":"string"
}} `, which doesn't have a `:type` key, against the `s/conditional` schema
-- this is probably the cause of the error you're actually seeing.
- Even if the conditional did match, it would be saying that 'the map that
has "mytype1" as a value for key :type, must be a String', which can never
be a true assertion (since it can't be both a map and a String).
If you can provide some executable code that errors, and a description of
what you are hoping the result would be, I'd be happy to provide more
detailed suggestions on how to fix it.
Best,
Jason
On Tuesday, May 17, 2016 at 5:12:07 AM UTC+7, Peeyush Jain wrote:
>
> Hello everyone,
> I am very new to clojure programming. I have a
> problem with my schema validation and i have asked the question on
> stackoverflow. link: http://stackoverflow.com/q/37263775/3639192 . I know
> it is a very basic question but i have been trying to solve it for a long
> time. Any help would be appreciated.
>
> Thanks,
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.