Skip to content
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

generate empty collections for missing fields #741

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

juliano
Copy link
Contributor

@juliano juliano commented Sep 13, 2024

/fixes #664
/closes #664
/claim #664

Copy link

algora-pbc bot commented Sep 13, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe.

@@ -534,6 +535,7 @@ object Schema extends SchemaPlatformSpecific with SchemaEquality {

override def toString: String = s"Sequence($elementSchema, $identity)"

override def empty: Col = Seq.empty[Elem].asInstanceOf[Col]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw except Col == List. Correct should be

Suggested change
override def empty: Col = Seq.empty[Elem].asInstanceOf[Col]
override def empty: Col = fromChunk(Chunk.empty[Elem])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for this case too

@juliano juliano force-pushed the missing-field-as-empty-collection branch from aab983f to 64050bd Compare September 17, 2024 10:14
@987Nabil 987Nabil merged commit 0e69702 into zio:main Sep 18, 2024
26 checks passed
@juliano juliano deleted the missing-field-as-empty-collection branch September 18, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Json Codec: Read missing field as empty collection
2 participants