Remove auto-derivation enabled by default
See original GitHub issueHi there,
This might be a bit controversial, but auto-derivation is bringing quite a few non-small problems to us, from increased compilation times, to inadvertently, codifying case class that weren’t expected to be there.
We are defining the Codecs/SchemaFor explicitly, and that helps, but it’s inconvenient to not have the help of the compiler to tell you which one is missing because the missing ones are auto generated.
I would rather have explicit imports for the required behaviour, like circe or zio-json:
import com.sksamuel.avro4s.derivation.auto._
import com.sksamuel.avro4s.derivation.semi._
I am aware if accepted this is a breaking change, but If accepted, I would be willing to put forward a PR.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to turn off form autocompletion - Web security | MDN
This article explains how a website can disable autocomplete for form fields. By default, browsers remember information that the user ...
Read more >Macros from the internet will be blocked by default in Office
Provides guidance for admins about how Office blocks macros in files from the internet.
Read more >Auto DevOps - GitLab Docs
GitLab triggers the Auto DevOps pipeline on the default branch. To disable it, follow the same process and clear the Default to Auto...
Read more >Delete significant locations on iPhone
In Maps on iPhone, delete records of the places you recently visited.
Read more >Reset/remove CSS styles for element only
For example certain elements like textarea by default have a border, ... You are simply building on a reset common core set of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yea, this one bit me too. I spent days trying to figure out why the
FieldMapper
wasn’t working. It turns out that the macro looks at the local scope at every point where theDecoder
is requested. This means that you cannot define the correctFieldMapper
for the model in the companion object where the schema is generated (as you do for most type-class based codecs). This is especially a problem when some models use snake_case and others do not as you cannot mix the two in a generic situation as you cannot know which type needs whichFieldMapper
. The fact that auto-derivation is the default and the field mapper is assumed based on local scope effectively makes theFieldMapper
unusable for us.Yeah, pretty much, I would say:
Semiauto is where you define your typeclass instances in the companion object (usually) by calling the
gen
macro.And at the calling site, e.g.: