config icon indicating copy to clipboard operation
config copied to clipboard

Yaml support

Open Renkai opened this issue 8 years ago • 5 comments

I think the API of this is elegant and confort to use, but my job needs me to use yaml files, is there any way to parse yaml to a com.typesafe.config.Config?

Renkai avatar Sep 14 '17 03:09 Renkai

Yaml libraries are just as large as this library so we don't depend on one. One approach could be to parse the yaml with a yaml lib then render it as json then parse the json with this lib. Not efficient but possibly very easy to implement and for a one time startup cost probably inefficient is fine.

There was also an issue with some discussion of allowing a yaml plugin to be dropped in, iirc, but don't think anyone has seriously worked on it.

havocp avatar Sep 14 '17 04:09 havocp

I'm also interested on YAML support since it's much nicer for configuration than a JSON file. I understand that doubling the size because of the YAML parsers is not a good thing and this framework should remain as lightweight as possible.

On option is to make the dependency to the YAML parser optional so only those that want to use YAML will suffer the addition of the YAML library.

pablolagreca avatar Aug 16 '19 14:08 pablolagreca

I think some kind of “SPI” approach where the yaml parser can be dropped on the classpath could be worth exploring

havocp avatar Aug 16 '19 14:08 havocp

I have YAML working locally for the most part. I was hoping an SPI approach would come up because being limited by the ConfigSyntax enum was driving me nuts.

jamesratzlaff avatar Sep 06 '19 13:09 jamesratzlaff

Has anyone considered a two-step process? I am interested in exchanging notes.

  1. Outside of Lightbend Config, convert YAML to JSON - https://stackoverflow.com/questions/23744216/how-do-i-convert-from-yaml-to-json-in-java
  2. Load generated JSON into Lightbend Config

sualeh avatar Sep 23 '20 13:09 sualeh