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

APIGW: fix OpenAPI import StatusCode string casting #12137

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Jan 14, 2025

Motivation

We got a report that importing a specific OpenAPI file in API Gateway v1 would result in a type error in OpenTOFU:

deserialization failed, failed to decode response body with invalid JSON, expected StatusCode to be of type string, got json.Number instead

This is because we were not casting as string the status code for the Method status code, and the IntegrationResponse.

Changes

  • add a test reproducing a similar exception
  • cast imported status codes to string

@bentsku bentsku added aws:apigateway Amazon API Gateway semver: patch Non-breaking changes which can be included in patch releases labels Jan 14, 2025
@bentsku bentsku self-assigned this Jan 14, 2025
@bentsku bentsku requested a review from cloutierMat as a code owner January 14, 2025 14:22
Copy link

github-actions bot commented Jan 14, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 50m 16s ⏱️ -37s
3 979 tests +1  3 663 ✅ +1  316 💤 ±0  0 ❌ ±0 
3 981 runs  +1  3 663 ✅ +1  318 💤 ±0  0 ❌ ±0 

Results for commit abf0057. ± Comparison against base commit 7e62817.

♻️ This comment has been updated with latest results.

"responseParameters": {
"method.response.header.Access-Control-Allow-Origin": "'*'"
},
"statusCode": "200",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before the fix, this would have been an int and fail with some typed languages trying to decode the response

@bentsku bentsku force-pushed the fix-apigw-get-resources branch from ec9d3b4 to abf0057 Compare January 20, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:apigateway Amazon API Gateway semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant