Skip to content

fix: preserve ANY routes when merging API definitions - #4004

Open
proton0210 wants to merge 1 commit into
aws:developfrom
proton0210:feature/sam-merge-definitions-any-method
Open

proton0210 wants to merge 1 commit into
aws:developfrom
proton0210:feature/sam-merge-definitions-any-method

Conversation

@proton0210

Copy link
Copy Markdown

Issue #, if available

Closes #4000. Thanks to @tiagohconte for the reproduction and proposed fix.

Description of changes

With MergeDefinitions: true, SAM writes ANY events under any instead of x-amazon-apigateway-any-method. It also drops generated routes when the inline paths is empty, null or missing.

Use the normalized method name for both lookup and write-back, and retain the paths dictionary in the merged body. Existing inline fields are preserved while SAM's generated integration takes precedence. Correcting the API body changes the deployment hash for affected templates.

Description of how you validated changes

  • make pr on Python 3.12: all checks passed, 4,672 tests passed, 95.63% coverage.
  • Eight new regression cases fail before the fix and pass afterward; a GET control passes in both versions.
  • Transform snapshots cover missing/null paths and an existing OpenAPI ANY operation with CORS in all three partitions.
  • An additional local audit passed 60 transform combinations covering method casing, Swagger/OpenAPI, five paths states, CORS and multiple events.

No live AWS deployment was run.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This branch has not been deployed

No deployments
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.

MergeDefinitions: true merges Method: ANY API events as any instead of x-amazon-apigateway-any-method

1 participant