-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed as not planned
Labels
bugSomething isn't workingSomething isn't working
Description
What happened:
mini.proto
syntax = "proto3";
package core.v1alpha1;
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";
service BookService{
rpc Correct(CorrectRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/correct/{meta.namespace=*}/name/{book.name=*}"
body: "*"
};
}
rpc Incorrect(IncorrectRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/incorrect/{meta.namespace=*}/name/{meta.name=*}"
body: "*"
};
}
}
message Meta {
string namespace = 1;
string name = 2;
}
message Book {
string name = 1;
}
message CorrectRequest {
Meta meta = 1;
Book book = 2;
}
message IncorrectRequest {
Meta meta = 1;
}
buf.gen.yaml:
plugins:
- plugin: go-http
out: api
opt:
- paths=source_relative
mini_http.pb.go:
func RegisterBookServiceHTTPServer(s *http.Server, srv BookServiceHTTPServer) {
r := s.Route("/")
r.POST("/api/correct/{meta.namespace:.*}/name/{book.name:.*}", _BookService_Correct0_HTTP_Handler(srv))
r.POST("/api/incorrect/{meta.name:.*}/name/{meta.name=*}", _BookService_Incorrect0_HTTP_Handler(srv))
}
What you expected to happen:
mini_http.pb.go:
func RegisterBookServiceHTTPServer(s *http.Server, srv BookServiceHTTPServer) {
r := s.Route("/")
r.POST("/api/correct/{meta.namespace:.*}/name/{book.name:.*}", _BookService_Correct0_HTTP_Handler(srv))
r.POST("/api/incorrect/{meta.namespace:.*}/name/{meta.name=*}", _BookService_Incorrect0_HTTP_Handler(srv))
}
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
If change meta.namespace
to meta.id
, everything looks fine.
service BookService{
rpc Correct(CorrectRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/correct/{meta.id=*}/name/{book.name=*}"
body: "*"
};
}
rpc Incorrect(IncorrectRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/incorrect/{meta.id=*}/name/{meta.name=*}"
body: "*"
};
}
}
message Meta {
string id = 3;
string namespace = 1;
string name = 2;
}
...
func RegisterBookServiceHTTPServer(s *http.Server, srv BookServiceHTTPServer) {
r := s.Route("/")
r.POST("/api/correct/{meta.id:.*}/name/{book.name:.*}", _BookService_Correct0_HTTP_Handler(srv))
r.POST("/api/incorrect/{meta.id:.*}/name/{meta.name:.*}", _BookService_Incorrect0_HTTP_Handler(srv))
}
Environment:
- Kratos version (use
kratos -v
): kratos version v2.6.2 - Go version (use
go version
): go version go1.19.5 darwin/arm64 - OS (e.g:
cat /etc/os-release
): - Others:
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working