sksamuel / hoplite

A boilerplate-free Kotlin config library for loading configuration files as data classes
Apache License 2.0
924 stars 74 forks source link

Provide support for moshi #220

Closed yogurtearl closed 2 years ago

yogurtearl commented 3 years ago

If I want to use hoplite-json in a kotlin app that only uses Moshi , currently there is no way to avoid bringing in Jackson as a dep.

It would be great to avoid bringing in a separate JSON parser just for hoplite.

this can be accomplished with something like the ConverterFactory concept that Retrofit has: https://github.com/square/retrofit/tree/master/retrofit-converters

Would you be open to a PR to make JSON parsers configurable/optional?

sksamuel commented 3 years ago

Yes sounds good, if you want to provide some interface that allows the json parser to be specified.

sksamuel commented 2 years ago

Started looking at adding this, but it seems that moshi works on types only, and I can't get a generic "tree" of the json. Without that, we can't build the arbitrary maps that Hoplite uses, because the json config files aren't always a one to one mapping with your config types, because of the cascading.

sksamuel commented 2 years ago

@yogurtearl I will close this based on the above comments, unless you know a way to achieve what we need with moshi.