Skip to content

exposed extra_context CLI option to pass cookiecutter parameter#1500

Merged
awood45 merged 7 commits intoaws:developfrom
gupta-n:develop
Nov 7, 2019
Merged

exposed extra_context CLI option to pass cookiecutter parameter#1500
awood45 merged 7 commits intoaws:developfrom
gupta-n:develop

Conversation

@gupta-n
Copy link
Contributor

@gupta-n gupta-n commented Nov 5, 2019

Issue #, if available:
NA
Description of changes:
Exposing extra_context as SAM CLI argument to pass cookiecutter parameter
Checklist:

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

Copy link
Contributor

@awood45 awood45 left a comment

Choose a reason for hiding this comment

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

Some concerns about error handling, can we expand the test coverage and be intentional about how we fail on bad inputs?

extra_context = default_context
else:
merged_context = default_context.copy()
extra_context_dict = json.loads(extra_context)
Copy link
Contributor

Choose a reason for hiding this comment

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

How are we handling it when users provide invalid JSON?

Copy link
Contributor Author

@gupta-n gupta-n Nov 6, 2019

Choose a reason for hiding this comment

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

updated and added test.

self.name,
True,
{"project_name": "testing project", "runtime": "python3.6", "schema_name": "events", "schema_type": "aws"},
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some invalid input tests to confirm proper behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added test

Copy link
Contributor

@awood45 awood45 left a comment

Choose a reason for hiding this comment

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

Small cleanup comment, otherwise looks good.

jfuss
jfuss previously requested changes Nov 6, 2019
try:
extra_context_dict = json.loads(extra_context)
except JSONDecodeError:
raise UserException(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make an explicit Exception here? Something like:

class InvalidCliParameterValue(UserException):
    pass

@awood45 awood45 dismissed jfuss’s stale review November 6, 2019 23:55

Jacob offline, his comments addressed. - Alex

@awood45 awood45 merged commit 42586d4 into aws:develop Nov 7, 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.

3 participants