Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Close #125
So, here is the issue: during parsing of hocon object, we need to store object's keys. And with double-quoted keys, if we will include
'"'
sign in the key, we will not be able to make requests likeconfig.GetInt("a")
ifa
was double-quoted. Or, if we will omit'"'
sign when storing the key ) which looks better, and this is what we are doing) - we will loose information that this key was double-quoted.This information is not that important - until we will try to get value from object by it's path. That is exactly what happens when we call
config.GetObject("A")
for example - recursively it will iterate children, using keys of the object like hocon paths.And guess what - for double-quoted key "X.Y" we have hocon path "X.Y" (we do not know that is was double-quoted, so it is handled like
X -> Y
), but object hasX.Y
key, and does not haveX
. So that's why we are getting error.After some experiments with keeping double-quotes in keys and other stuff, I ended up with idea that it is better to think about such keys lookup as a special case - and each time when we are requesting child by hocon path, I am just checking if full path is preset in object's keys. So for path
X.Y
it will checkX.Y
, and thenX
->Y
.