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

Make HOCON config ToString() method more readable #1703

Closed
Horusiath opened this issue Feb 14, 2016 · 3 comments
Closed

Make HOCON config ToString() method more readable #1703

Horusiath opened this issue Feb 14, 2016 · 3 comments

Comments

@Horusiath
Copy link
Contributor

Right now HoconConfig ToString method produces string containing only key-vals of the current config. Since structure of config objects often heavily relies of fallback mechanism, in order to get all current (overriden) key-vals in current config section is very exhausting.

Therefore we could change current ToString behavior (or expose its version in form of ToString(string format)) that could return all of the current key-values for the hocon config. Example, given two hocon configs A and B with set in fallback relation:

# A
some.path {
  key11 = "value11"
  key12 = "value12"
}

# B
some.path {
  key11 = "value21"
  key22 = "value22"
}

using configA.WithFallback(configB).ToString(indentation: true) would print current key-values of A, followed by key-values being fallback from B:

some.path {
  key11 = "value11" 
  key12 = "value12"
  key22 = "value22"
}
@mukulsinghsaini
Copy link
Contributor

Hi Horusiath,
I have implemented this method. It gives the current key-values merged with key-values from fallback.
It can work on multiple fallback chains likeconfigA.WithFallback(configB).WithFallback(configC)...

I have used the method signature
public string ToString(Boolean includeFallback)

I want to confirm if its ok to use this method signature or I need to improve it before I send a pull request.Thanks.

@Horusiath
Copy link
Contributor Author

@mukulsinghsaini I think it's a good idea :) Could you create a PR and link this issue with it?

mukulsinghsaini added a commit to mukulsinghsaini/akka.net that referenced this issue Mar 17, 2016
mukulsinghsaini added a commit to mukulsinghsaini/akka.net that referenced this issue Mar 17, 2016
marcpiechura pushed a commit that referenced this issue Mar 17, 2016
…lback-1703

#1703 ToString overloaded to make HOCON config ToString more readable by including fallback
@marcpiechura
Copy link
Contributor

Closed via #1800

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

3 participants