protobuf-php icon indicating copy to clipboard operation
protobuf-php copied to clipboard

Allow to keep default values in serialized JSON

Open RojerUA opened this issue 4 years ago • 1 comments

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.

RojerUA avatar Mar 17 '20 13:03 RojerUA

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

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 .

TeBoring avatar Mar 17 '20 14:03 TeBoring