googleapis / googleapis/google-cloud-java

[sdk-platform-java] GAPIC HttpJson additional_bindings annotation is not being used

Đang mở
#12,507 6 bình luận 0 reaction 1 người được giao Được @nnicolee nhận Xem trên GitHub
priority: p4 type: bug
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
157

Mô tả

Discovered while implementing Showcase testing for the ComplianceSuite. This fails the `Compliance.RepeatDataPathTrailingResource` test case: `Testing group: `Binding selection testing`- RPC Name: `Compliance.RepeatDataPathResource` with Request Name: `Binding testing additional binding`.

The path template for `Compliance.RepeatDataPathResource`:
`/v1beta1/repeat/{info.fString=first/*}/{info.fChild.fString=second/*}/bool/{info.fBool}:pathresource`. The data is
```
"info": {
"fString": "second/greetings",
"pBool": true,

"fChild": {
"fString": "first/hello"
}
}
```
Since `info.fString` exists, it spliced in as `second/greetings` and `info.fChild.fString` exists, so it's spliced in as `first/hello`. But the path template is expecting something matching `first/*` which `second/greetings` doesn't match. This is same issue with `second/**` not matching with `first/hello`.

The additional_binding for this RPC is `/v1beta1/repeat/{info.fChild.fString=first/*}/{info.fString=second/*}/bool/{info.fBool}:childfirstpathresource` and this will match the pathTemplate correctly.

Our logic is wrong in that:
1. It doesn't validate the match
2. Doesn't even have logic to check the additional_bindings

Error Logs:
Java side:
```
Caused by: com.google.api.client.http.HttpResponseException: 400 Bad Request
GET http://localhost:7469/v1beta1/repeat/second/greetings/first/hello/bool/false:pathresource?fInt64=0&info.pBool=true&intendedBindingUri=/v1beta1/repeat/%7Binfo.f_child.f_string%3Dfirst/*%7D/%7Binfo.f_string%3Dsecond/*%7D/bool/%7Binfo.f_bool%7D:childfirstpathresource&serverVerify=true&name=Binding%20testing%20additional%20binding&info.fString=second/greetings&fInt32=0&fDouble=0.0&info.fChild.fString=first/hello
{"error":{"code":400,"message":"unrecognized request: GET \"/v1beta1/repeat/second/greetings/first/hello/bool/false:pathresource?fInt64=0\u0026info.pBool=true\u0026intendedBindingUri=/v1beta1/repeat/%7Binfo.f_child.f_string%3Dfirst/*%7D/%7Binfo.f_string%3Dsecond/*%7D/bool/%7Binfo.f_bool%7D:childfirstpathresource\u0026serverVerify=true\u0026name=Binding%20testing%20additional%20binding\u0026info.fString=second/greetings\u0026fInt32=0\u0026fDouble=0.0\u0026info.fChild.fString=first/hello\"","details":null,"Body":"","Header":null,"Errors":null}}
```

Showcase Server:
```
2023/03/07 18:02:36 unrecognized request: GET "/v1beta1/repeat/second/greetings/first/hello/bool/false:pathresource?fInt64=0&info.pBool=true&intendedBindingUri=/v1beta1/repeat/%7Binfo.f_child.f_string%3Dfirst/*%7D/%7Binfo.f_string%3Dsecond/*%7D/bool/%7Binfo.f_bool%7D:childfirstpathresource&serverVerify=true&name=Binding%20testing%20additional%20binding&info.fString=second/greetings&fInt32=0&fDouble=0.0&info.fChild.fString=first/hello"
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.