Skip to content

Add option including JSON default value for transcoding#252

Draft
mutexd wants to merge 1 commit intoeclipse-vertx:5.0from
mutexd:feature/include-json-default-value
Draft

Add option including JSON default value for transcoding#252
mutexd wants to merge 1 commit intoeclipse-vertx:5.0from
mutexd:feature/include-json-default-value

Conversation

@mutexd
Copy link
Copy Markdown

@mutexd mutexd commented Apr 14, 2026

Motivation:

I'm using grpc-transcoding so that I can have one grpc-service implementation which can serve both Grpc/REST entry point. However, the JsonPrinter's default behavior excludes default values such as int32:0, string:"". Therefore, a GrpcResponse with
{ "message": "Hello", "status": 0 }
will become like this for REST response.
{ "message": "Hello" }
Even though it's valid in terms of ProtoJSON, it would be nice to have default values because JSON in REST conventionally includes default value like this.

Draft for #261 (need discussion)
Adds a flag for vertx-grpc-protoc-plugin2 and directly embeds printer.includingDefaultValueFields() into transcoding's encoder method. Changing the ServiceMethod signature should be avoided and therefore I approach the issue from vertx-grpc-protoc-plugin2.

@mutexd
Copy link
Copy Markdown
Author

mutexd commented Apr 20, 2026

If the approach taken doesn't align with the structure of the project, I would like to delete this PR and create an issue. A feedback would be appreciated.

@zZHorizonZz
Copy link
Copy Markdown
Member

Hello, thank you for the contribution.

I think it would be better to convert this to a draft and open an issue so it can be discussed, more in depth.

@mutexd mutexd marked this pull request as draft April 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants