-
Notifications
You must be signed in to change notification settings - Fork 162
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
fix: handle missing collection fields in JSON decoding #688
base: main
Are you sure you want to change the base?
fix: handle missing collection fields in JSON decoding #688
Conversation
} | ||
|
||
// Helper method to create an empty collection based on the schema | ||
private def createEmptyCollection(schema: Schema[_]): Any = |
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.
I think this logic belongs to the trait Collection
in Schema.scala
, so each collection schema has to implement a method that creates an empty collection.
@@ -104,13 +104,13 @@ object JsonCodec { | |||
def jsonEncoder[A](cfg: JsonCodec.Config)(schema: Schema[A]): ZJsonEncoder[A] = | |||
JsonEncoder.schemaEncoder(schema, cfg) | |||
|
|||
def jsonDecoder[A](schema: Schema[A]): ZJsonDecoder[A] = | |||
def jsonDecoder[A](schema: Schema[A])(implicit config: JsonCodec.Config): ZJsonDecoder[A] = |
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.
Changes are binary incompatible.
Config should not be implicit.
You should not reuse the same config value, since these are two different features. They should be configurable independent of each other.
fixes #664
/closes #664
/claim #664