protobuf-php
protobuf-php copied to clipboard
Allow to keep default values in serialized JSON
We use Protobuf to define API endpoints and spotted surprising behavior - items with default values are absent in the serialized JSON. It is uncommon for PHP REST APIs to have parameters disappearing from response when returned value is default one. This PR solves this problem without braking default behavior.
I would like to hear your feedback on proposed solution. Thanks.
Could you send this PR to protobuf’s main repo?
On Tue, Mar 17, 2020 at 6:20 AM Alexander Shiltcev [email protected] wrote:
We use Protobuf to define API endpoints and spotted surprising behavior - items with default values are absent in the serialized JSON. It is uncommon for PHP REST APIs to have parameters disappearing from response when returned value is default one. This PR solves this problem without braking default behavior.
I would like to hear your feedback on proposed solution. Thanks.
You can view, comment on, or merge this pull request online at:
https://github.com/protocolbuffers/protobuf-php/pull/6 Commit Summary
- Allow to keep default values in serialized JSON
File Changes
- M README.md https://github.com/protocolbuffers/protobuf-php/pull/6/files#diff-04c6e90faac2675aa89e2176d2eec7d8 (7)
- M src/Google/Protobuf/Internal/GPBWire.php https://github.com/protocolbuffers/protobuf-php/pull/6/files#diff-6d4f2e77838aaccbe4cc7a7a1370ad87 (10)
- M src/Google/Protobuf/Internal/Message.php https://github.com/protocolbuffers/protobuf-php/pull/6/files#diff-e2ee323e57d24611a2b3e21edf4fd598 (116)
Patch Links:
- https://github.com/protocolbuffers/protobuf-php/pull/6.patch
- https://github.com/protocolbuffers/protobuf-php/pull/6.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/protocolbuffers/protobuf-php/pull/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHUPZO3YQURT3ONSAGGHP3RH52LVANCNFSM4LNNOPLQ .