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

[tcgc] change response structure to mapping with key number, status code range, or * #515

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

iscai-msft
Copy link
Contributor

The HttpOperationResponse that @typespec/http returns to us has property .statusCodes on each of them. The type of this is HttpStatusCodeRange | number | "*". On the tcgc side, we're creating a map to more easily map status codes to the expected responses. We used to map this as a Record of number | string (we would do some processing magic for status codes). However, we've decided to switch to a Map since it can handle complex key inputs, and made the key inputs the same as the .statusCodes type from tsp for fidelity.

All instances of passing the responses to Object.keys(responses) / Object.values(responses) / Object.items(responses) should be changed, and you can directly access the native .keys(responses) etc

@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

@azure-sdk
Copy link
Collaborator

@iscai-msft iscai-msft enabled auto-merge (squash) March 26, 2024 20:37
@iscai-msft iscai-msft merged commit c5ef8f3 into main Mar 26, 2024
14 checks passed
@iscai-msft iscai-msft deleted the response_structure branch March 26, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants