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

Json Protocol support #156

Merged
merged 5 commits into from
Nov 18, 2017
Merged

Json Protocol support #156

merged 5 commits into from
Nov 18, 2017

Conversation

reisub
Copy link
Contributor

@reisub reisub commented Oct 16, 2017

I started from the official Thrift implementation, made it work and tried to clean up the style in the process. Let me know if there's anything you'd like me to change, happy to do it.

I already signed the contributor agreement for an earlier PR.

Closes #154.

@codecov-io
Copy link

codecov-io commented Oct 16, 2017

Codecov Report

Merging #156 into master will increase coverage by 0.61%.
The diff coverage is 73.17%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #156      +/-   ##
============================================
+ Coverage     65.51%   66.13%   +0.61%     
- Complexity      938     1012      +74     
============================================
  Files            89       90       +1     
  Lines          4843     5268     +425     
  Branches        562      611      +49     
============================================
+ Hits           3173     3484     +311     
- Misses         1431     1524      +93     
- Partials        239      260      +21
Impacted Files Coverage Δ Complexity Δ
...java/com/microsoft/thrifty/testing/TestServer.java 76.62% <100%> (+0.3%) 18 <0> (+1) ⬆️
.../com/microsoft/thrifty/testing/ServerProtocol.java 100% <100%> (ø) 1 <0> (ø) ⬇️
...a/com/microsoft/thrifty/protocol/JsonProtocol.java 73.04% <73.04%> (ø) 73 <73> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6817551...2833b4d. Read the comment docs.

@reisub
Copy link
Contributor Author

reisub commented Oct 29, 2017

@benjamin-bader did you have time to look at this code?


@Test
public void binary() throws Exception {
protocol.writeBinary(ByteString.encodeUtf8("foobar"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should exercise the base-64 coder and decoder more thoroughly here. Let's generate an array of bytes from 0..255 and encode that, so that we hit all of the encoding/decoding table entries.

I'm assuming that those are copied verbatim from Apache, and so are almost certainly correct, but we shouldn't assume such things in tests :)

Copy link
Contributor Author

@reisub reisub Nov 1, 2017

Choose a reason for hiding this comment

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

Yes, your assumption is correct. And yeah, I'll add tests for the decoding.

@benjamin-bader
Copy link
Collaborator

Yes, sorry for the delay - I've been an overloaded maintainer on quite a few projects for the past while. This change is nice and self-contained, which is great, but is also large. Am I correct in thinking that this is mainly a copy-and-adapt implementation based on Apache's?

@reisub
Copy link
Contributor Author

reisub commented Nov 1, 2017

@benjamin-bader I understand - don't worry about it, it's not urgent.

You're right, Apache's implementation was the basis for this PR.

@reisub
Copy link
Contributor Author

reisub commented Nov 1, 2017

I wrote a test for the base64 decoding (see e33a66d).

But then I realized we can use the base64 decoding from the Okio ByteString class. So I changed the implementation to use that instead, making it simpler.

@benjamin-bader let me know if you want anything else changed.

@reisub
Copy link
Contributor Author

reisub commented Nov 17, 2017

@benjamin-bader is there anything I can do to help you review and merge this work?

@benjamin-bader benjamin-bader merged commit 4c5e96b into microsoft:master Nov 18, 2017
@benjamin-bader
Copy link
Collaborator

Thanks for contributing!

@reisub reisub deleted the feature/json-protocol-support branch November 21, 2017 19:50
accandme pushed a commit to accandme/thrifty that referenced this pull request Oct 18, 2019
Add Json Protocol support
luqasn added a commit to luqasn/thrifty that referenced this pull request Nov 18, 2020
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.

None yet

3 participants