Repository navigation
fix: preserve ANY routes when merging API definitions - #4004
proton0210 wants to merge 2 commits into
Conversation
…definitions-any-method
reedham-aws
left a comment
There was a problem hiding this comment.
There is only one thing I'm concerned about in this PR: the existing case where a user has manually defined x-amazon-apigateway-any-method in the DefinitionBody while also providing an ANY method as part of the event source. Previously, that would have worked because of the value already in the definition body, while silently dropping what was in the event method. Now, the code is forcing the opposite and it's the manual DefinitionBody that is getting dropped.
I'm not quite sure what to make of this because it will change the behavior of existing templates, but at the same time that behavior was a bug. Theoretically, we can make the change, and then create an announcement mentioning that this might happen (not sure how many users would run into this).
Issue #, if available
Closes #4000. Thanks to @tiagohconte for the reproduction and proposed fix.
Description of changes
With
MergeDefinitions: true, SAM writesANYevents underanyinstead ofx-amazon-apigateway-any-method. It also drops generated routes when the inlinepathsis 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 pron Python 3.12: all checks passed, 4,672 tests passed, 95.63% coverage.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.