-
Notifications
You must be signed in to change notification settings - Fork 20
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
Hocon config companions #562
base: master
Are you sure you want to change the base?
Conversation
|
||
/** | ||
* Use this type in data deserialized from HOCON to in order to read size in bytes represented with | ||
* [[https://github.com/lightbend/config/blob/master/HOCON.md#size-in-bytes-format HOCON's nice representation]]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this source, there are a lot more strings supported in HOCON.
|
||
import scala.concurrent.duration.* | ||
|
||
trait CommonsHoconCodecs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, naming: we already have CborOptimizedCodecs
and BsonGenCodecs
. Maybe we should try to stay consistent with one of those in naming (probably the latter).
input.readCustom(ConfigValueMarker).map { | ||
case obj: ConfigObject => obj.toConfig | ||
case v => throw new ReadFailure(s"expected a config OBJECT, got ${v.valueType}") | ||
}.getOrElse { | ||
ConfigFactory.parseString(input.readSimple().readString()) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I could be convinced this is one of the rare instances where .fold
looks cleaner
implicit final val classKeyCodec: GenKeyCodec[Class[?]] = | ||
GenKeyCodec.create(Class.forName, _.getName) | ||
|
||
implicit final val classCodec: GenCodec[Class[?]] = | ||
GenCodec.nullableString(Class.forName, _.getName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the use case for those in config?
Add base companions for classes representing HOCON config