(logic/is nil schema (fn [s] (s "format")))
or
(logic/pred schema (fn [s] (not (contains? s "format"))))
clumsy - but works
still interested to hear what other people think of this approach...
Jules
On Wednesday, 30 September 2020 at 17:15:42 UTC+1 Jules wrote:
> Guys,
>
> I recently wrote some Clojure to take a JSON Schema and corresponding JSON
> document and produce a JSON document in another JSON "dialect".
>
> Then I realised that I needed to write the reverse transformation.
>
> I've been wondering how I might capture the relationship between the two
> JSON dialects in such a way as to be able to travel backwards and forwards
> between them using the same code,
>
> A long time ago I wrote a lot of PROLOG, so I thought I would have a look
> at core.logic.
>
> I managed some limited success using 'featurep' to inspect schema nodes
> for e.g. {"type" "string"} and then {"type" "string" "format" "date-time"}
> but now my date-times are also matching my string code :-( - I tried using
> {"type" "string" "format' nil} to match non-date-time strings but no joy -
> I really need something like 'non-featurec'...
>
> core.logic seems to be very quiet. Should I press on - in which case I'd
> be interested to hear of any solutions that folks have come up with for
> implementing mutually exclusive sets of 'features' - or should I look for
> another solution - in which case can anyone suggest anything ?
>
> I find the idea of using core.logic to do bi-directional JSON doc
> transformations really appealing - what do others think ?
>
>
> Jules
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/2830a7ba-c46c-4fa3-a149-c2a76be6de44n%40googlegroups.com.