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

feat: additional validation and bin/sam-translate.py update #873

Merged
merged 10 commits into from
Apr 1, 2019

Conversation

brettstack
Copy link
Contributor

@brettstack brettstack commented Mar 26, 2019

  • Add additional commands
  • Update parameters to be consistent with SAM CLI
  • Add additional parameters
  • Improve logging
  • Fixes

* Add additional commands
* Update parameters to be consistent with SAM CLI
* Add additional parameters
* Improve logging
* Fixes
@brettstack brettstack changed the base branch from master to develop March 26, 2019 18:22
@codecov-io
Copy link

codecov-io commented Mar 26, 2019

Codecov Report

Merging #873 into develop will decrease coverage by 0.03%.
The diff coverage is 88.88%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #873      +/-   ##
===========================================
- Coverage    94.66%   94.62%   -0.04%     
===========================================
  Files           69       69              
  Lines         2978     2997      +19     
  Branches       547      554       +7     
===========================================
+ Hits          2819     2836      +17     
- Misses          84       85       +1     
- Partials        75       76       +1
Impacted Files Coverage Δ
samtranslator/model/eventsources/push.py 88.85% <100%> (+0.07%) ⬆️
samtranslator/swagger/swagger.py 97.57% <100%> (+0.01%) ⬆️
samtranslator/model/sam_resources.py 95.5% <100%> (ø) ⬆️
samtranslator/parser/parser.py 90.9% <100%> (+2.67%) ⬆️
samtranslator/intrinsics/actions.py 98.7% <100%> (+0.01%) ⬆️
...lator/plugins/application/serverless_app_plugin.py 82.11% <70%> (-0.28%) ⬇️

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 0fc2ca6...eda4c2f. Read the comment docs.

jlhood
jlhood previously approved these changes Mar 29, 2019
Copy link
Contributor

@jlhood jlhood left a comment

Choose a reason for hiding this comment

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

Key question that comes up looking at this is why are we writing this when SAM CLI exists? Had a discussion on it and determined that installing SAM CLI and pointing it towards the samtranslator repo adds yet more overhead for contributors to get setup. So this lightweight CLI tool adds value.

One minor comment to confirm you've tested the latest changes, but otherwise, looks good!

bin/sam-translate.py Show resolved Hide resolved
@brettstack brettstack requested review from jlhood and keetonian and removed request for jlhood March 29, 2019 21:02
Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Sar Plugin Location bug fixes- some comments and questions.

if not app_id:
raise InvalidResourceException(logical_id, "Property 'ApplicationId' cannot be blank.")

if isinstance(app_id, dict):
raise InvalidResourceException(logical_id, "Property 'ApplicationId' cannot be resolved. Only FindInMap "
Copy link
Contributor

Choose a reason for hiding this comment

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

The error messages for both of these instances are practically the same, any way we could re-use the verbage and insert the property name?

semver = self._replace_value(app.properties[self.LOCATION_KEY],
self.SEMANTIC_VERSION_KEY, intrinsic_resolvers)

if isinstance(app_id, dict) or isinstance(semver, dict):
key = (json.dumps(app_id), json.dumps(semver))
self._applications[key] = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you choose to set this to False?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just needed a value here. Wanted to get any other recommendations from you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. We're getting a value here because we don't resolve intrinsics until later, right? Could we resolve them earlier so that the flow in this area remains the same?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can actually stick an error instead of False into self._applications[key]. If the app_id or semver is still a dict, we won't resolve it any further so we'll just have to return an error at some point.

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Properties is a dict commit review.

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Commit introducing validation for FindInMap and GetAtt looks good 👍

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Empty Stage Name commit looks good 👍

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Swagger path commit looks good 👍

Copy link
Contributor

@keetonian keetonian left a comment

Choose a reason for hiding this comment

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

Alias ValueError change looks good, just one question on commented out section of the test template.

@keetonian keetonian dismissed jlhood’s stale review March 29, 2019 21:52

Dismissing review- there are new changes that need to be reviewed since this review was done.

Copy link
Contributor

@jlhood jlhood left a comment

Choose a reason for hiding this comment

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

Just a minor file naming change. Everything else looks good!

tests/translator/test_translator.py Outdated Show resolved Hide resolved
@brettstack brettstack merged commit 2ccd9e7 into aws:develop Apr 1, 2019
@brettstack brettstack changed the title feat: update bin/sam-translate.py feat: additional validation and bin/sam-translate.py update Apr 1, 2019
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