exposed extra_context CLI option to pass cookiecutter parameter#1500
Merged
awood45 merged 7 commits intoaws:developfrom Nov 7, 2019
gupta-n:develop
Merged
exposed extra_context CLI option to pass cookiecutter parameter#1500awood45 merged 7 commits intoaws:developfrom gupta-n:develop
awood45 merged 7 commits intoaws:developfrom
gupta-n:develop
Conversation
awood45
suggested changes
Nov 5, 2019
Contributor
awood45
left a comment
There was a problem hiding this comment.
Some concerns about error handling, can we expand the test coverage and be intentional about how we fail on bad inputs?
samcli/commands/init/__init__.py
Outdated
| extra_context = default_context | ||
| else: | ||
| merged_context = default_context.copy() | ||
| extra_context_dict = json.loads(extra_context) |
Contributor
There was a problem hiding this comment.
How are we handling it when users provide invalid JSON?
Contributor
Author
There was a problem hiding this comment.
updated and added test.
| self.name, | ||
| True, | ||
| {"project_name": "testing project", "runtime": "python3.6", "schema_name": "events", "schema_type": "aws"}, | ||
| ) |
Contributor
There was a problem hiding this comment.
Can we add some invalid input tests to confirm proper behavior?
awood45
suggested changes
Nov 6, 2019
Contributor
awood45
left a comment
There was a problem hiding this comment.
Small cleanup comment, otherwise looks good.
awood45
suggested changes
Nov 6, 2019
jfuss
previously requested changes
Nov 6, 2019
samcli/commands/init/__init__.py
Outdated
| try: | ||
| extra_context_dict = json.loads(extra_context) | ||
| except JSONDecodeError: | ||
| raise UserException( |
Contributor
There was a problem hiding this comment.
Can we make an explicit Exception here? Something like:
class InvalidCliParameterValue(UserException):
pass
8 tasks
awood45
approved these changes
Nov 6, 2019
Jacob offline, his comments addressed. - Alex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
NA
Description of changes:
Exposing extra_context as SAM CLI argument to pass cookiecutter parameter
Checklist:
make prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.