GithubHelp home page GithubHelp logo

Comments (3)

borkdude avatar borkdude commented on August 27, 2024

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

from clj-yaml.

rymndhng avatar rymndhng commented on August 27, 2024

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

from clj-yaml.

borkdude avatar borkdude commented on August 27, 2024

Thanks for the information!

from clj-yaml.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.