googleapis / googleapis/google-cloud-node

(DI)REGAPIC generated Promise types in long running operations appear to be incorrect

Aperta
#7,693 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
library: google-cloud-node-core priority: p2 size: s type: bug
Lingua principale
TypeScript
Stelle
3.2k
Fork
713
Merge medio
2g 9h
PR unite (30g)
104

Descrizione

I noticed this when I was working on something else entirely, and I'm not sure I want to try to fix it as part of this (may be a breaking change even if it's wrong).

The template looks like this:

```
{%- if method.isDiregapicLRO %}
Promise<[
LROperation<{{ util.toInterface(method.outputInterface) }}, null>,
{{ util.toInterface(method.outputInterface) }}|undefined, {}|undefined
{%- else %}
Promise<[
{{ util.toInterface(method.outputInterface) }},
{{ util.toInterface(method.inputInterface) }}|undefined, {}|undefined
{%- endif %}
]>|void {
```

It seems to me like the intended difference between these two blocks is LROperation<> wrapping, versus not, but the first one has `method.outputInterface` twice. The generated code looks like this:

```
delete(
request?: protos.google.cloud.compute.v1.IDeleteAddressRequest,
optionsOrCallback?: CallOptions|Callback<
protos.google.cloud.compute.v1.IOperation,
protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined,
{}|null|undefined>,
callback?: Callback<
protos.google.cloud.compute.v1.IOperation,
protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined,
{}|null|undefined>):
Promise<[
LROperation,
protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined
]>|void {
```

The Promise at the bottom shows IOperation twice, but the callbacks show IOperation and IDeleteAddressRequest (this is in compute cjs). This leads me to believe, given the parallels in the type thruple, that there's an issue here. Probably the second one in the Promise part should also be IDeleteAddressRequest.

#### Environment details

- Programming language: Generator templates
- OS: Linux
- Language runtime version: Node 18.12.0
- Package version: main

#### Steps to reproduce

- It's just part of the repo templates.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Cerca nei template del generatore il blocco isDiregapicLRO mostrato nell’issue, quindi confronta la relativa tupla Promise con i tipi di callback nel client Compute cjs generato. Verifica che i tipi di output e input dell’operazione a lunga esecuzione siano coerenti e rigenera o ispeziona il metodo delete interessato per confermare la dichiarazione corretta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
nodejs, typescript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.