googleapis / googleapis/google-cloud-java

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

Abierto
#12,507 6 comentarios 0 reacciones 1 asignado Reclamado por @nnicolee Ver en GitHub
priority: p4 type: bug
Lenguaje dominante
Java
Estrellas
2.1k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
154

Descripción

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"
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.