Closed vreuter closed 10 months ago
Yeah we ignore unknown keys to allow for graceful schema evolution and backwards compatibility: an upstream component can start adding new keys and the downstream component can begin recognizing them later, without the need for a lockstep update of both components
Adding a flag to make it strict is certainly possible, and there are use cases it would be handy
Makes total sense, thanks for the reply! Do you prefer I close this, then, or leave open as a small feature for the future?
Let's leave it open as a feature request
@vreuter this fix should have gone out in the latest version 3.1.4
Awesome, thanks @lihaoyi !
Hello! I have a test case that's failing at the moment, and the behavior suggests that it's because the presence of extra keys (beyond those corresponding to the fields of a case class) is not problematic when attempting to parse JSON to a value of the case class, when the reader in question is in scope by virtue of the case class having been written with a
derives
declaration.I understand the value of having more lax / less strict parsing behavior, particularly in the context of trait hierarchies, but in my case there's no hierarchy and I'd like to opt for stricter behavior if it's not too much additional effort. If it's helpful, I could describe the test case and why it suggests to me that the behavior is as I describe above.
Thanks in advance!