Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.01k stars 131 forks source link

Google Translate v2 API returns an empty response for a simple query #441

Closed festeh closed 1 year ago

festeh commented 1 year ago

Hi!

I wanted to run a simple query like

 hub
    .translations()
    .list(
        &vec![
            "Was wollen Sie sagen?".to_string(),
        ],
        "en",
    )
    .doit()
    .await;

but I got an empty TranslationsListResponse.

I dig into sources and found out that actual json body of http response is fine

res_body_string = : {
  "data": {
    "translations": [
      {
        "translatedText": "What do you want to say?",
        "detectedSourceLanguage": "de"
      }
    ]
  }
}

but when it converted into TranslationsListResponse, the translations field is none. I think it's due to a "data" key in response. WDYT?

Byron commented 1 year ago

It could be that the API description has changed, so the datatypes and what the API actually responds with is now different. As immediate fix, you could vendor the sources and patch it. Otherwise, I recommend checking in the README how to update the API descriptions to regenerate the API. Maybe the latest version has updated data-structures.

festeh commented 1 year ago

Thanks for the response!