Azure / typespec-azure

About TypeSpec Azure Libraries
https://azure.github.io/typespec-azure/
MIT License
11 stars 37 forks source link

[Bug]: `SdkHttpResponse.contentTypes?` can be empty array #992

Closed archerzz closed 3 months ago

archerzz commented 3 months ago

Describe the bug

minor

SdkHttpResponse.contentTypes is an optional array: https://github.com/Azure/typespec-azure/blob/d30db5bd8bf78c5eb237ea8cdbc0e98755a86be1/packages/typespec-client-generator-core/src/interfaces.ts#L435-L440

So it would be better to either a non-empty array or undefined, but not an empty array.

Reproduction

Try to parse a spec like https://github.com/Azure/cadl-ranch/blob/main/packages/cadl-ranch-specs/http/authentication/http/custom/main.tsp

You'll find the contentTypes is an empty array. image

Checklist

iscai-msft commented 3 months ago

good point, let me fix this