Suggest owainlewis/yaml as alternative?
Opened this issue · 3 comments
It looks like this library isn't actively maintained anymore. I'd suggest looking at https://github.com/owainlewis/yaml as an alternative.
@rymndhng
This library seems to be actively maintained here: https://github.com/clj-commons/clj-yaml
I'd be interested to hear what the differences between owainlewis/yaml and clj-yaml are.
Hey @borkdude. It's been a while since I've needed to work with yaml
in clojure. It looks like both libraries are built on top of the Java Library snakeyaml
. Furthermore, both attempt to convert YAML into Clojure Data Structure (yay)!
One useful feature of owainlewis/yaml
is the ability to ignore unknown YAML tags using the passthrough-constructor
. I've had to use this in the past to parse yaml generated by other tools/languages. Arguably, this feature should be easy to port to clj-commons/yaml ;)
Example:
With clj-commons/clj-yaml
❯ clj -Sdeps '{:deps {clj-commons/clj-yaml {:mvn/version "0.7.0"}}}'
user=> (require '[clj-yaml.core :as yaml])
user=> (yaml/parse-string "--- !foobar
foo: HELLO WORLD")
Execution error (ConstructorException) at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructUndefined/construct (SafeConstructor.java:539).
could not determine a constructor for the tag !foobar
in 'string', line 1, column 5:
--- !foobar
^
With owainlewis/yaml
using :passthrough-constructor
❯ clj -Sdeps '{:deps {io.forward/yaml {:mvn/version "1.0.10"}}}'
user=> (require '[yaml.core :as yaml])
user=> (yaml/parse-string "--- !foobar
foo: HELLO WORLD" :constructor yaml.reader/passthrough-constructor)
#ordered/map ([:foo "HELLO WORLD"])
Thanks for the information!