Support unknown reader tags while reading EDN
thenonameguy opened this issue · 4 comments
There should be an easy way to pass through tagged literals that are unknown through jet.
Recommendation:
Augment
Line 33 in 4c93fde
to support
:default
, with a CLI flag --edn-read-default=sci-expr
.Interesting idea. Would it make sense to also support other data readers by passing a map? Maybe we could just pass in additional args to tools.reader with an option --tools-reader-opts
which acceps a map with :readers
and :default
which will be evaluated by sci?
Yes, that could also work. Alternatively I would be okay with a simple boolean flag to enable tagged-literal
so that passthrough works: https://insideclojure.org/2018/06/21/tagged-literal/
The above combined:
Allow --edn-opts
with:
:readers
option with accepts map of symbol -> function:default
which you can passtagged-literal
. So a combination of the above.
The entire map will be evaluated by sci. For this to work I'd have to add tagged-literal to sci first.
Example call:
echo '[#foo{:a 1} #bar {:a 2}]' | jet --from edn --edn-opts '{:readers {foo (fn [x] [:foo x])} :default tagged-literal}'
Output:
[[:foo {:a 1}] #bar {:a 2}]
Fixed in v0.0.12 by adding the --edn-reader-opts
option.