Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
Tracked by #3994
archerzz opened this issue Jun 12, 2024 · 1 comment · Fixed by #1070
Closed
4 tasks done
Tracked by #3994

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

archerzz opened this issue Jun 12, 2024 · 1 comment · Fixed by #1070
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@archerzz
Copy link
Member

Describe the bug

minor

SdkHttpResponse.contentTypes is an optional array:

export interface SdkHttpResponse extends SdkServiceResponse {
__raw: HttpOperationResponse;
kind: "http";
contentTypes?: string[];
defaultContentType?: string;
}

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

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@archerzz archerzz added bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library labels Jun 12, 2024
@iscai-msft
Copy link
Contributor

good point, let me fix this

github-merge-queue bot pushed a commit that referenced this issue Jun 24, 2024
… empty list (#1070)

fixes #992

---------

Co-authored-by: iscai-msft <[email protected]>
markcowl pushed a commit to markcowl/typespec-azure that referenced this issue Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants