clj-yaml icon indicating copy to clipboard operation
clj-yaml copied to clipboard

There is snakeyaml-engine 2.x - (new snakeyaml version)

Open ieugen opened this issue 4 years ago • 6 comments

Hi,

To whom it may concern, there is snakeyaml-engine - which is the new/refactored version of the library https://bitbucket.org/asomov/snakeyaml-engine/src/master/ .

There are some changes here and a wiki with documentation https://bitbucket.org/asomov/snakeyaml-engine/wiki/Changes .

Load api for yaml in version 2.3 https://javadoc.io/doc/org.snakeyaml/snakeyaml-engine/latest/org/snakeyaml/engine/v2/api/Load.html

Regards,

ieugen avatar Nov 02 '21 11:11 ieugen

Hi @ieugen, are you suggesting that we change clj-yaml to build on top of SnakeYAML 2.x?

Are there any user-visible benefits from that upgrade?

FWIW, in recent projects at CircleCI, I've taken to using SnakeYAML directly, rather than clj-yaml. I don't expect the folks at CircleCI to put in any major investment in this library at present.

marcomorain avatar Nov 02 '21 12:11 marcomorain

If I may chime in, as an outsider:

  • the latest snakeyaml-engine release was 2.3 (2021-04-19)
    • it's still active (https://bitbucket.org/snakeyaml/snakeyaml-engine/commits/), though
  • the "original" library (https://bitbucket.org/snakeyaml/snakeyaml/commits/) is still in active development as well.
    • latest version of the original library is 1.30 (2021-12-14)

So I'm not exactly sure which is the "new" library, and what the difference between the APIs is, and what improvements to switching.

There is a Google Group (https://groups.google.com/g/snakeyaml-core), is someone is interested in venturing deeper.

Cheers

The-Alchemist avatar Mar 02 '22 04:03 The-Alchemist

As far as I understand, the biggest difference is that snakeyaml supports YAML 1.1, whereas snakeyaml-engine supports YAML 1.2.

My usecases of YAML all involve very simple YAML files, so I can't bring to mind a clojure use-case where this would matter.

wongjoel avatar Apr 26 '22 12:04 wongjoel

As far as I understand, the biggest difference is that snakeyaml supports YAML 1.1, whereas snakeyaml-engine supports YAML 1.2.

Thank you, @wongjoel . I agree that this is the biggest difference between snakeyaml and snakeyaml-engine. Looks like YAML 1.2 is designed to move it closer to a superset of JSON (i.e., explicitly support JSON).

There's also some internal changes to make smaller modules it looks like. Some references:

  • https://en.wikipedia.org/wiki/YAML#Comparison_with_JSON
  • https://groups.google.com/g/snakeyaml-core/c/L0Tf21ONvaI

Migration to snakeyaml-engine would be a nice addition, but probably a low priority. We can throw the YAML 1.2 files from the spec at the unit tests and see what happens. If I have the time, I'll take a stab at it. ;)

The-Alchemist avatar Apr 26 '22 13:04 The-Alchemist

Doesn't snakeyaml use snakeyaml-engine internally?

borkdude avatar Apr 26 '22 13:04 borkdude

Doesn't snakeyaml use snakeyaml-engine internally?

I don't think so.

  • Separate web pages
    • https://bitbucket.org/snakeyaml/snakeyaml/src/master/

SnakeYAML is a YAML 1.1 processor for the Java Virtual Machine version 7. For YAML 1.2 (which is a superset of JSON) you may have a look at SnakeYAML Engine

  • https://bitbucket.org/asomov/snakeyaml-engine/wiki/Home
  • separate releases in Maven Central

The-Alchemist avatar Apr 26 '22 13:04 The-Alchemist

Trying snakeyaml engine as the "backend" of this lib would likely solve https://github.com/clj-commons/clj-yaml/issues/35

borkdude avatar Sep 14 '22 18:09 borkdude