Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YAML] Path resolution failing if a key is numeric #45

Closed
dkambersky opened this issue Dec 21, 2019 · 8 comments
Closed

[YAML] Path resolution failing if a key is numeric #45

dkambersky opened this issue Dec 21, 2019 · 8 comments

Comments

@dkambersky
Copy link

I apologise if this is intended and documented somewhere, I couldn't find it mentioned anywhere.
Consider this yaml config file:

tree:
  1:
    myVal: true

This will fail to resolve properly (i.e. config.at("tree.1.myVal").toValue<Boolean>())).
However, if that 1 is renamed to a1, everything works properly.

@uchuhimo
Copy link
Owner

@dkambersky Thank you for your report! I have fixed it in a new release v0.22.0. Please have a try.

@dkambersky
Copy link
Author

Thanks for the quick response. It seems like it fails for values over an int's max value - e.g. 484444731619803154. The exact error thrown is

com.uchuhimo.konf.PathConflictException: "tree.484444731619803154.key" conflicts with existed paths in the tree node.

@uchuhimo
Copy link
Owner

@dkambersky Yes, it only support int now. You can use "484444731619803154" instead of 484444731619803154 to work around it, E.g.,

tree:
  "484444731619803154":
    myVal: true

Is it necessary to support such a large number in your use case? If not, I will delay long / BigInteger support to the next release with other features/bugfixes.

@dkambersky
Copy link
Author

dkambersky commented Dec 23, 2019 via email

@uchuhimo
Copy link
Owner

@dkambersky I release a new version v0.22.1 that fixes the problem. Please have a try.

@dkambersky
Copy link
Author

dkambersky commented Dec 24, 2019

Same error unfortunately :( But I'll just use the string workaround for now, thanks again for being this fast to respond!

@uchuhimo
Copy link
Owner

@dkambersky I have added your example code as tests and all the tests are passed (see https://github.com/uchuhimo/konf/blob/master/konf-yaml/src/test/kotlin/com/uchuhimo/konf/source/yaml/YamlSourceLoadSpec.kt#L44-L73). Thus I believe the error has been gone. Would you like to provide your code that still has the same error?

@uchuhimo uchuhimo reopened this Dec 24, 2019
@dkambersky
Copy link
Author

I'm sorry, that was my own oversight. It's working fine now. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants