streem / pbandk

Kotlin Code Generator and Runtime for Protocol Buffers
MIT License
271 stars 37 forks source link

JSON serialization of default value for fields with explicit presence #238

Closed antongrbin closed 2 years ago

antongrbin commented 2 years ago

Motivation

Fixes https://github.com/streem/pbandk/issues/235

Changes

This is consistent with the following: https://github.com/protocolbuffers/protobuf/blob/main/docs/field_presence.md#semantic-differences

This PR also changes behavior of outputDefaultValues for unset nested message fields. Before we were outputting null and now we don't output any value. This is consistent with c++, python and java, as explained here: https://github.com/noom/protobuf/pull/5

Tested

Run all unit tests in runtime