Description
There are some use cases where the default scheme of generating the JsonValueCodec
can cause some issues when migrating from another library (such as play-json) where custom formats have been defined.
One good feature (IMO) about play-json is that all of the nested objects must have json encoder/decoder (Reads/Writes) in scope for the macro to succeed.
In my case we have a custom serialisation format written in play-json which I would like to move to jsoniter for speed. These encoder/decoder(s) are not defined on the companion objects for the classes in question because they come from an in house geometry library, which has no awareness of JSON at all. And unfortunately there are next to no unit tests for this json serialisation (although no doubt I will have to find some payloads in the wild and add some).
This would help in the migration for this use case, as it would force me to think about the serialisation of each data type
Proposal
Add a new configuration option to CodecMakerConfig
something like val deriveNestedDataTypes: Boolean
which will default to true
.
Naively I think that it could be placed here, but no doubt it will be more complex than that
def inferImplicitValue(typeTree: Tree): Tree = c.inferImplicitValue(c.typecheck(typeTree, c.TYPEmode).tpe, silent = config.deriveNestedDataTypes)
Activity