pyhocon icon indicating copy to clipboard operation
pyhocon copied to clipboard

Unresolved optional substitutions are lost during merge

Open aalba6675 opened this issue 6 years ago • 2 comments

Corner case extracted from java issue #332(https://github.com/lightbend/config/issues/332);

  1. Top config {foo:42, foo: ${?a}}. Create an unresolved ConfigTree: unresolved
  2. Base config source: {b: 14} - which doesn't actually provide a
  3. unresolved.with_fallback(source)

Expected value: {foo:42, b:14}

Instead we get {b: 14}. When doing merge_configs() we have overwritten the overriden_value (42) of foo so we lose the ability to resolve it so it is left out of the final ConfigTree

aalba6675 avatar May 03 '18 08:05 aalba6675

+1 pyhocon handling of sub vars no longer work.

ayen-tibco avatar May 08 '18 17:05 ayen-tibco

+1, here a simple case to reproduce

import pyhocon

parser = pyhocon.ConfigFactory()
conf2 = """
x: {
    a: ${?test}
}
x: {
    a: 3
    a: ${?test}
}
"""
result = parser.parse_string(conf2)
assert result.get("x").get("a") == 3

Currently the assertion failed and the actual value is None instead of 3 if test was not defined

etiennebrateau avatar Nov 22 '22 15:11 etiennebrateau