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

feat(type-safe-api): include error header expected by smithy generated client in handler wrappers #468

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

cogwirrel
Copy link
Member

Clients generated directly from Smithy (using the typescript-codegen plugin) can deserialise error responses into the appropriate generated model classes, but they do this by checking for a special x-amzn-errortype header.

This change updates the generated handler wrappers to include the appropriate value for this header for error responses. Note that OpenAPI specs generated from Smithy add "ResponseContent" as a suffix to all response data types, so we remove this in order to match the appropriate error structure ID. If the response data type doesn't end with ResponseContent, it didn't come from Smithy so there's no need to return this header anyway.

re #460

…d client in handler wrappers

Clients generated directly from Smithy (using the typescript-codegen plugin) can deserialise error
responses into the appropriate generated model classes, but they do this by checking for a special
`x-amzn-errortype` header. This change updates the generated handler wrappers to include the
appropriate value for this header for error responses. Note that OpenAPI specs generated from Smithy
add "ResponseContent" as a suffix to all response data types, so we remove this in order to match
the appropriate error structure ID. If the response data type doesn't end with ResponseContent, it
didn't come from Smithy so there's no need to return this header anyway.

re #460
@nx-cloud
Copy link

nx-cloud bot commented Jun 13, 2023

☁️ Nx Cloud Report

Attention: This version of the Nx Cloud GitHub bot will cease to function on July 1st, 2023. An organization admin can update your integration here.

CI is running/has finished running commands for commit 43051c3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@cogwirrel cogwirrel merged commit 293fab0 into mainline Jun 13, 2023
@cogwirrel cogwirrel deleted the feat/amzn-errortype branch June 13, 2023 02:07
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.

2 participants