Skip to content

Conversation

qingchm
Copy link
Contributor

@qingchm qingchm commented Jan 17, 2022

Issue #, if available:
N.A.

Description of changes:
If the tags in the definition body is not a list, the tags parsing will cause iteration errors.

Description of how you validated changes:
Added a check for the validity of the definition body that has tags specified.

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.

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2022

Codecov Report

Merging #2295 (9830c60) into develop (e7a1496) will increase coverage by 0.81%.
The diff coverage is 96.83%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2295      +/-   ##
===========================================
+ Coverage    93.58%   94.39%   +0.81%     
===========================================
  Files           90       97       +7     
  Lines         6124     7088     +964     
  Branches      1260     1435     +175     
===========================================
+ Hits          5731     6691     +960     
+ Misses         183      181       -2     
- Partials       210      216       +6     
Impacted Files Coverage Δ
samtranslator/model/api/http_api_generator.py 91.21% <75.00%> (+0.02%) ⬆️
samtranslator/model/api/api_generator.py 93.69% <89.09%> (-0.67%) ⬇️
samtranslator/model/apigateway.py 96.98% <96.00%> (-0.18%) ⬇️
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/intrinsics/actions.py 98.79% <100.00%> (+0.07%) ⬆️
samtranslator/metrics/method_decorator.py 100.00% <100.00%> (ø)
samtranslator/metrics/metrics.py 100.00% <100.00%> (ø)
samtranslator/model/__init__.py 97.64% <100.00%> (ø)
... and 34 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 b3fd85d...9830c60. Read the comment docs.

[
InvalidTemplateException(
"Tags in open api definition needs to be a list. {} is a {} not a list.".format(
self.tags, type(self.tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps better to get rid of the weird Pythonism (<class 'dict'>)?

Suggested change
self.tags, type(self.tags)
self.tags, type(self.tags).__name__

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure yes that makes the message more readable! Will add in this change

@qingchm qingchm requested a review from hoffa January 18, 2022 22:01
@hawflau hawflau merged commit aec6e18 into aws:develop Jan 20, 2022
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