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

Implement protobuf codec for case class schemas #46

Merged
merged 4 commits into from
Apr 27, 2021

Conversation

thinkharderdev
Copy link
Contributor

No description provided.

@thinkharderdev thinkharderdev requested a review from a team as a code owner April 24, 2021 00:06
JsonCodec.Encoder.charSequenceToByteChunk("""{"value":{"string":"foo"}}""")
JsonCodec.Encoder.charSequenceToByteChunk("""{"oneOf":{"StringValue":{"value":"foo"}}}""")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jdegoes I'm not 100% sure about this but I think the encoding before was wrong w/r/t case classes with ADT fields. Not sure if the way it was implemented was just an optimization though....

} yield assert(e)(equalTo("0A03466F6F107B")) && assert(e2)(equalTo("0A03466F6F107B"))
},
testM("enumerations") {
for {
e <- encode(schemaEnumeration, Enumeration(IntValue(482))).map(toHex)
e2 <- encodeNS(schemaEnumeration, Enumeration(IntValue(482))).map(toHex)
} yield assert(e)(equalTo("0A0310E203")) && assert(e2)(equalTo("0A0310E203"))
} yield assert(e)(equalTo("0A05120308E203")) && assert(e2)(equalTo("0A05120308E203"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same thing here as above.

jdegoes
jdegoes previously approved these changes Apr 26, 2021
@jdegoes
Copy link
Member

jdegoes commented Apr 26, 2021

@thinkharderdev Looks good to merge after the conflict is fixed!

@jdegoes jdegoes merged commit 7d2ca7f into zio:main Apr 27, 2021
@jdegoes
Copy link
Member

jdegoes commented Apr 27, 2021

Thanks for your work on this! Protobuf continues to improve.

landlockedsurfer pushed a commit to landlockedsurfer/zio-schema that referenced this pull request May 28, 2022
* Implement protobuf codec for case class schemas

* Add cases for all case class arities

* resolve merge issue

Co-authored-by: thinkharder <thinkharderdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants