Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.03k forks source link

TranslatorText DetectResult definition appears to be incorrect #9180

Open nguerrera opened 4 years ago

nguerrera commented 4 years ago

I discovered this when the JavaScript SDK gave me an array of DetectResultItem back from a call to TranslatorText.detect:

export interface DetectResultItem {
  text?: string;
}

That did not match the actual objects returned, which were instead as documented:

image

It appears that the API spec here is incorrect:

https://github.com/Azure/azure-rest-api-specs/blob/2e7ca21a5ad6f749e5bd453580f1c31c1d99b4e6/specification/cognitiveservices/data-plane/TranslatorText/stable/v3.0/TranslatorText.json#L176

https://github.com/Azure/azure-rest-api-specs/blob/2e7ca21a5ad6f749e5bd453580f1c31c1d99b4e6/specification/cognitiveservices/data-plane/TranslatorText/stable/v3.0/TranslatorText.json#L996-L1007

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dfulcer.

nguerrera commented 4 years ago

I think I found another one in the same service:

LanguageResult here: https://github.com/Azure/azure-rest-api-specs/blob/2e7ca21a5ad6f749e5bd453580f1c31c1d99b4e6/specification/cognitiveservices/data-plane/TranslatorText/stable/v3.0/TranslatorText.json#L642

does not appear to match: https://docs.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-languages

Spec seems to say we'll get back something like this:

{
    "translation": {
         "languageCode":  {
            "name": "Afrikaan",
            "nativeName": "Afrikaans",
            "dir": "ltr"
        }
    }
}

but the actual response looks like this:

https://github.com/Azure/azure-rest-api-specs/blob/2e7ca21a5ad6f749e5bd453580f1c31c1d99b4e6/specification/cognitiveservices/data-plane/TranslatorText/stable/v3.0/examples/languagesSuccess.json#L12-L48

Rather than one single, literal "languageCode", we have a property for each language code.

If I'm not misunderstanding these, it seems the entire spec should be reviewed for similar issues.

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @swmachan.