jkcfg / jk

Configuration as Code with ECMAScript
https://jkcfg.github.io
Apache License 2.0
404 stars 30 forks source link

Support for YAML streams #341

Closed alexec closed 4 years ago

alexec commented 4 years ago

I have a YAML file that contains multiple objects. A YAML stream.

I can't see how to iterate over it?

dlespiau commented 4 years ago

Would you mind giving an example of YAML stream you have? just to be sure we are talking about muli-documents YAML rather than a YAML file with an array of objects.

I should be able to write an example with your sample input :)

alexec commented 4 years ago

YAML streams are just .yaml files with --- to delimit them. E.g. https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/install.yaml

I have found a way to do this:

      read(
        "/resources/upstream.yaml",
        { format: Format.YAMLStream }
      )
squaremo commented 4 years ago

Yes, std.Format.YAMLStream is what you want -- you get an array of the documents. There's no actual streaming reads or writes, for now.

Alex, can we close this one?