Open melrief opened 7 years ago
Thanks a lot for this report! From this trace I can figure out that there are at least 3 kind of errors we can classify and try to manage:
unwrapped
(just need to be implemented) or ConfigFactory.load()
just need to remove -X:fatalWarnings
invalidateCaches()
is it possible on your side to move this kind of calls to a separate modue that will be "JVM specific"?valueType
could work here.@andreaTP did you find 10 minutes to have a look at this?
TBF I'm not sure it makes sense to implement the missing Java shims so that PureConfig can then turn them back into its own internal AST repr :P it would make sense to target SHocon's own native API or to agree upon a common repr we can use both :-)
I'm trying to pull off the same thing for zio-config and running into the same problems. I'm also not sure about how to proceed here. I could use SHocon's native API in one module and the Typesafe API in another module, but I'd either have to duplicate quite a bit of code or complicate the architecture by finding ways to deal with the stuff that is in Typesafe but not in SHocon. Does somebody have an intuition how complicated it would be to port the following classes/methods?
ConfigList
ConfigValueFactory
withValue
unwrapped
atKey
Hi @nightscape ! Thanks for the interest! Let me try to have a first peek:
ConfigList
should just be a matter of wrapping values accordingly in the facade
since shocon
is already able to parse List
of Config
s: https://github.com/akka-js/shocon/blob/master/facade/shared/src/main/scala/com/typesafe/config/Config.scala#L186ConfigValueFactory
again looks like is just a facade
https://lightbend.github.io/config/latest/api/com/typesafe/config/ConfigValueFactory.html should be implemented, requires solely someone's time IIUCwithValue
/ atKey
to be implemented in the facade
since they are helper methods to insert/mangle the Config Tree (note that using them we are possibly going to invalidate most of the macro
based optimizations)
unwrapped
is already implemented and should work (of course, modulo bugs) https://github.com/akka-js/shocon/blob/29bcb1768d0da98d80b51cd02c875ab0514430dd/facade/shared/src/test/scala/SHoconGenericSpec.scala#L280-L293All in all looks pretty doable to me having time to spend on the subject(e.g. carefully reading the specification and the code of the original implementation, checking edge cases etc.. ).
I'm not really focused on improving this library by myself at this point (and have other priorities), but I'm available for guidance/merging PRs/releasing accordingly if anyone wants to pick up the challenge!
@andreaTP thanks for the estimation & tips! I need to finish another part of the project I'm working on, but I'll try to create a PR once I'm in cleanup mode :wink:
I've tried to use shocon as replacement for typesafe config as backend of
pureconfig
. I've pushed the branchtry_shocon_as_backend
if you are interested. The project doesn't compile because shocon API is missing some parts of typesafe config API.To reproduce, just run
sbt "++ 2.12.1 core/compile"
. The error list is