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 json decoding for Any message. #130

Merged
merged 10 commits into from Dec 4, 2018

Conversation

TeBoring
Copy link
Contributor

type url may not appear as the first value in json. As a result,
other data cannot be resolved before resolving type url. To solve that,
this change caches the start and end position of unparsed values and
resolve them in end_any_object when type url has been resolved.

@TeBoring
Copy link
Contributor Author

Fix protocolbuffers/protobuf#5130

return false;
}

json_parser_any_frame_set_packed(p, p->top->any_frame, packed);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use a name other than "packed"? I thought this was somehow related to packed repeated fields. Maybe json_parser_any_frame_set_type()? And maybe call the variable here any_type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to payload_type.

upb_json_parser* parser;
upb_sink sink;

/* Mark the range of unpacked values in json input before type url. */
Copy link
Member

Choose a reason for hiding this comment

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

Maybe uninterpreted instead of unpacked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -191,6 +191,9 @@ endif
upb_json_SRCS = \
upb/json/parser.c \
upb/json/printer.c \
upb/pb/encoder.c \
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't put these sources in more than one library. Instead add dependencies on libupb.pb.a to binaries that need it.

Or help me get Kokoro Bazel tests going, so we can delete the Travis tests and the Makefile completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Left this. Will fix it after kokoro fix.

type url may not appear as the first value in json. As a result,
other data cannot be resolved before resolving type url. To solve that,
this change caches the start and end position of unparsed values and
resolve them in end_any_object when type url has been resolved.
@TeBoring TeBoring merged commit 13c59cb into protocolbuffers:master Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants