Skip to content

Conversation

@CoshUS
Copy link
Contributor

@CoshUS CoshUS commented Oct 4, 2021

Issue #, if available:
OAS 3 added summary and description fields to path. SAM tries to resolve these fields as valid method sections.
https://swagger.io/docs/specification/paths-and-operations/
Example:

paths:
  /abc:
    summary: dummy summary
    get:
      x-amazon-apigateway-integration:
      contentHandling: CONVERT_TO_TEXT
method_definition.get(self._X_APIGW_INTEGRATION): -> "dummy summary".get(self._X_APIGW_INTEGRATION)

Description of changes:

Description of how you validated changes:

Checklist:

  • Add/update tests using:
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

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

@CoshUS CoshUS changed the title Added Exclusion for Non-Method Path Sections fix: Exclude Non-Method Path Sections Oct 4, 2021
@CoshUS CoshUS marked this pull request as draft October 4, 2021 23:20
@CoshUS CoshUS marked this pull request as ready for review October 5, 2021 08:18
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2021

Codecov Report

Merging #2171 (4713cd2) into develop (e7a1496) will increase coverage by 0.72%.
The diff coverage is 97.91%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2171      +/-   ##
===========================================
+ Coverage    93.58%   94.30%   +0.72%     
===========================================
  Files           90       95       +5     
  Lines         6124     6429     +305     
  Branches      1260     1290      +30     
===========================================
+ Hits          5731     6063     +332     
+ Misses         183      169      -14     
+ Partials       210      197      -13     
Impacted Files Coverage Δ
samtranslator/model/lambda_.py 93.10% <ø> (ø)
samtranslator/plugins/globals/globals.py 99.05% <ø> (ø)
samtranslator/region_configuration.py 77.77% <63.63%> (-22.23%) ⬇️
samtranslator/translator/translator.py 97.26% <90.00%> (+0.07%) ⬆️
samtranslator/swagger/swagger.py 94.00% <92.50%> (+0.63%) ⬆️
samtranslator/__init__.py 100.00% <100.00%> (ø)
samtranslator/feature_toggle/dialup.py 100.00% <100.00%> (ø)
samtranslator/feature_toggle/feature_toggle.py 100.00% <100.00%> (+12.16%) ⬆️
samtranslator/metrics/method_decorator.py 100.00% <100.00%> (ø)
samtranslator/metrics/metrics.py 100.00% <100.00%> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35ed6d0...4713cd2. Read the comment docs.

_CACHE_KEY_PARAMETERS = "cacheKeyParameters"
# https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
_ALL_HTTP_METHODS = ["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "PATCH"]
_EXCLUDED_PATHS_FIELDS = ["summary", "description", "parameters"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at https://swagger.io/specification/#path-item-object, should servers be in this list as well? As well, should we add trace to _ALL_HTTP_METHODS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

APIGW only supports GET, DELETE, HEAD, OPTIONS, PATCH, POST, and PUT.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's true. The thinking was that SAM could support the full standard and then SAM doesn't need to make adjustments if API GW adds support for trace (or other parts of the OpenAPI spec.) In any case, it's a minor point.

@CoshUS CoshUS merged commit fb4d963 into aws:develop Oct 8, 2021
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.

4 participants