Lcos-000 opened a new issue, #3733:
URL: https://github.com/apache/dubbo-go/issues/3733
## Background
Triple services currently expose HTTP requests mainly through the canonical
RPC path:
~~~text
POST /<package>.<Service>/<Method>
~~~
Protobuf services can also define HTTP mappings through `google.api.http`,
but these mappings are not currently applied to the actual Triple HTTP server
or reflected in the generated OpenAPI documents.
## Problem
This creates a mismatch between the service definition, the runtime HTTP
API, and the API documentation:
- HTTP paths declared in protobuf cannot be accessed directly;
- OpenAPI documents do not describe the REST paths defined by the service;
- clients need an additional gateway or custom HTTP handler to use standard
REST-style methods such as GET or PATCH;
- path and query parameter mappings defined in the IDL are not applied at
runtime.
## Proposal
Use `google.api.http` as the HTTP mapping source for Protobuf-defined Triple
services.
For example:
~~~proto
rpc GetBook(GetBookRequest) returns (Book) {
option (google.api.http) = {
get: "/v1/{name=publishers/*/books/*}"
};
}
~~~
The rule should provide both:
~~~text
GET /v1/publishers/acme/books/123
~~~
and the corresponding OpenAPI operation.
The implementation should reuse the existing Triple unary invocation path
and preserve the canonical RPC route. The feature should be opt-in so that
existing applications keep their current behavior by default.
This proposal is limited to the core flow:
~~~text
google.api.http → HTTP route → Triple service invocation → OpenAPI
~~~
## Relationship to Dubbo Java
Dubbo Java’s Triple REST support already allows REST-style HTTP access
through the existing Triple HTTP stack while preserving the canonical RPC
routes and reusing the normal service invocation chain. Custom routes in Java
are defined through Java-side mapping annotations such as `@Mapping`, Spring
Web, or JAX-RS annotations. [Dubbo Java Triple REST
documentation](https://dubbo.apache.org/en/overview/mannual/java-sdk/tasks/protocols/rest/)
This proposal follows the same runtime architecture and coexistence model,
but uses Protobuf `google.api.http` as the route definition source for
Dubbo-Go. It does not aim to provide compatibility with Java’s annotation model.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]