- 
                Notifications
    You must be signed in to change notification settings 
- Fork 70
Description
Discovered while implementing Showcase testing for the ComplianceSuite. This fails the Compliance.RepeatDataPathTrailingResource test case: Testing group: Binding selection testing- RPC Name: Compliance.RepeatDataPathResourcewith 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:
- It doesn't validate the match
- 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"