-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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(*): gRPC and cJSON's behavior to empty array #10790
Conversation
866ef3c
to
dc4300f
Compare
d4ae6cb
to
18cc5a6
Compare
cc5bb9a
to
9d271ad
Compare
9d271ad
to
dc719cb
Compare
Need a person familiar with Go to double-check. |
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.
two non-technical minor issues, otherwise lgtm
Lua does not distinguish empty arrays and tables, which makes empty array decoded from gRPC gateway be encoded as `{}` by cJSON. The fix makes use of cjson.empty_array_mt to hint the cJSON. Special thanks to starwing<[email protected]>, who spent their public holidays adapting new features for this issue. Fix FTI-5002
Co-authored-by: Wangchong Zhou <[email protected]>
e416cc8
to
2d5d2f2
Compare
rebased onto master to fix conflicts; good to merge whenever CI is 🟢 |
This fix was added very late so it was missing a the "cherrypick into 3.3" label (notice that this PR targets master). I just added it |
* fix(*): gRPC and cJSON's behavior to empty array Lua does not distinguish empty arrays and tables, which makes empty array decoded from gRPC gateway be encoded as `{}` by cJSON. The fix makes use of cjson.empty_array_mt to hint the cJSON. Special thanks to starwing<[email protected]>, who spent their public holidays adapting new features for this issue. Fix FTI-5002 * Apply suggestions from code review Co-authored-by: Wangchong Zhou <[email protected]> * Apply suggestions from code review --------- Co-authored-by: Wangchong Zhou <[email protected]> (cherry picked from commit b18252b)
Summary
Lua does not distinguish empty arrays and tables, which makes empty array decoded from gRPC gateway be encoded as
{}
by cJSON.The fix makes use of cjson.empty_array_mt to hint the cJSON.
Special thanks to @starwing, who spent their public holidays adapting new features for this issue.
Checklist
There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HEREFull changelog
cjson.empty_array_t
for arraysIssue reference
starwing/lua-protobuf#240
Fix FTI-5002
Fix #10801
Review suggestion
*.pb.go
are auto-generated