Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest owainlewis/yaml as alternative? #28

Open
rymndhng opened this issue Jan 3, 2018 · 3 comments
Open

Suggest owainlewis/yaml as alternative? #28

rymndhng opened this issue Jan 3, 2018 · 3 comments

Comments

@rymndhng
Copy link

rymndhng commented Jan 3, 2018

It looks like this library isn't actively maintained anymore. I'd suggest looking at https://github.com/owainlewis/yaml as an alternative.

@rymndhng rymndhng changed the title Suggest users to use owainlewis/yaml? Suggest owainlewis/yaml as alternative? Jan 3, 2018
@borkdude
Copy link

@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.

@rymndhng
Copy link
Author

rymndhng commented Feb 22, 2020

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"])

@borkdude
Copy link

Thanks for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants