0

In quarkus, is there a way to add a simple annotation, to expose underlying gRPC implementation as REST/json also? I.e two views with one implementation.

Springboot seem to have ProtobufJsonFormatHttpMessageConverter.

https://medium.com/@thinhda/build-service-that-provides-http-and-grpc-api-with-spring-9e7cff7aa17a

I belive proto syntax allows annotation for rest endpoint

syntax = "proto3";
package pn.api;
//import "google/protobuf/timestamp.proto";
//import "google/api/annotations.proto";

option java_package = "pn.api.protobuf";
option java_outer_classname = "Proto";

service SearchService{
    rpc search(SearchRequest) returns (SearchResponse){
        // option (google.api.http) = { get: "/v1/search/{queryObj}" };
    };
}
Espresso
  • 5,378
  • 4
  • 35
  • 66
  • Do I understand the example correctly, the spring example exposes "normal" REST endpoint but uses a class generated from `proto` as entity type? – Michał Szynkiewicz Feb 16 '21 at 18:47
  • Yes, you are right, looks like spring is making use of 'ProtobufJsonFormatHttpMessageConverter' to provide automatic DTO conversion, so both proto/rest-json are available at the same time. I modified the question for better clarity. – Espresso Feb 19 '21 at 13:40

1 Answers1

0

No.

There is no way to do it. If you think that's beneficial, feel free to create an issue in Github Issues (https://github.com/quarkusio/quarkus/issues) and we can discuss it there. In the issue, please focus on what would be a benefit of adding such a feature.