chimpler / pyhocon

HOCON parser for Python
Apache License 2.0
502 stars 118 forks source link

substitution in child configs is broken #289

Open Fohlen opened 2 years ago

Fohlen commented 2 years ago

Using pyhocon==0.3.59 including child configs breaks the substitution. See attached sample.zip.

You can verify this example using:

pyhocon -i sample/root.conf

The resulting output contains an empty:

{
  "my_obj": {}
}

Although according to substitution rules my_obj should contain a key_a with value default.

Fohlen commented 2 years ago

This is because in https://github.com/chimpler/pyhocon/blob/master/pyhocon/config_parser.py#L395 substitutions are explicitly disabled. If I understand the specification correctly, this is correct, as substitutions should happen "globally" after the object has been parsed. However with this implementation, such behaviour proves to be difficult to implement. Any ideas?