Handle well-known wrapper types in a way that matches grpc-gateway serialization/deserialization #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Given that the stated goal of this project is to generate idiomatic Typescript code for the grpc-gateway project, I thought this might be a useful contribution, but it seems like it's also a bit of a departure from existing behavior, so there might be some discussion.
Further work that I know is needed:
The default JSON marshaller/unmarshaller for the grpc-gateway has the following behavior for well-known wrapper types like
BoolValue
andStringValue
:boolean
orstring
types, orundefined
if nilboolean | undefined
, orstring | undefined
, and knows the difference between an empty param (empty value) and a missing param (nil value)However, the default behavior of this library has a couple differences of behavior that make working with these wrapper types difficult/inconsistent/partially-broken:
{ value: boolean }
or{ value: string }
as typesThis branch contains fixes for those two issues: