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

Expose ConfigValue parser #92

Open
neko-kai opened this issue Nov 30, 2019 · 0 comments
Open

Expose ConfigValue parser #92

neko-kai opened this issue Nov 30, 2019 · 0 comments

Comments

@neko-kai
Copy link

neko-kai commented Nov 30, 2019

It's extremely inconvenient to wrap a ConfigValue into a Config just to be able to pass it to the API:

cv =>
  val dec = derivationDerivedDecoder.value
  val (wrappedValue, path) = cv match {
    case configObject: ConfigObject =>
      configObject.toConfig -> None
    case _ =>
      ConfigValueFactory.fromMap(Map("_root_" -> cv).asJava).toConfig -> Some("_root_")
  }
  path.fold(parser.decode[T](wrappedValue)) {
    parser.decodePath[T](wrappedValue, _)
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant