-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON support to Protobuf codecs #25457
Comments
+1 |
Protobuf support is provided in Spring WebFlux via ProtobufDecoder and ProtobufEncoder. Could you please check what prevents you to use that support? |
Json serialization/deserialization doesn't work for protobufs when using webflux. |
Ok I understand now, so this is about providing similar capablities than |
Any word on this? |
Any updates on that? |
@rstoyanchev It would be great if you could prioritize this. We all see the benefit of webflux. but no support for protobuf :( |
This should be feasible, just mirroring what we've already done on the HttpMessageConverter side. I've scheduled it to have a look for the upcoming 6.1 milestone. |
Updates? |
@bucknerns we didn't get to this issue in time for 6.1. We're trying to prioritize specific themes and most requested features in our roadmap. We'll try to tackle this one in 6.2 but at two votes this hardly makes it a top priority right now. |
@HubertWo please use the GitHub voting feature by adding your vote on the original issue comment. Writing "+1" comments just adds noise and is not counted against the total vote count. |
@kitkars @sazonenka Can you plus the issue by hitting the thumbs up on the first comment. |
Thanks to all for upvoting this issue. We now have a dedicated codec for Protobuf+JSON. This comes with a noteworthy limitation: this codec does not support the deserialization of JSON arrays into In practice this means that @GetMapping(path="/users", produces = "application/json")
Flux<User> listUsers();
@GetMapping(path="/users/{id}", produces = "application/json")
Mono<User> showUser(@Pathvariable String id); But only @PostMapping(path="/users/create", consumes = "application/json")
Mono<Void> createUser(@RequestBody Mono<User> user)
// this case is not supported
@PostMapping(path="/users/createMany", consumes = "application/json")
Mono<Void> createUsers(@RequestBody Flux<User>> users)
// this should be used instead
@PostMapping(path="/users/createMany", consumes = "application/json")
Mono<Void> createUsers(@RequestBody Mono<List<User>> users) We'll document further this support in #33063 |
Use case: Developers want to create Protobuf service implementation, more efficient. However, also need to expose as rest/json, to support clients that consume json -- perhaps we are in technology-transition time?
This does not work for netty/webflux, but works for tomcat, so likely some platform config issue?
Please make it easy to expose PROTO implementation as rest, without code duplication.
https://stackoverflow.com/questions/60289736/spring-webflux-netty-no-tomcat-how-to-expose-proto-as-json-endopints-without/63022169#63022169
The text was updated successfully, but these errors were encountered: