-
Notifications
You must be signed in to change notification settings - Fork 79
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: inject project info into api overrides #1372
Conversation
if (!amplifyProjectInfo || !amplifyProjectInfo.envName || !amplifyProjectInfo.projectName) { | ||
throw new Error(`Project info is missing in override: ${JSON.stringify(amplifyProjectInfo)}`); | ||
} | ||
|
||
if (amplifyProjectInfo.envName != '##EXPECTED_ENV_NAME') { | ||
throw new Error(`Received unexpected envName: ${amplifyProjectInfo.envName}`); | ||
} | ||
|
||
if (amplifyProjectInfo.projectName != '##EXPECTED_PROJECT_NAME') { | ||
throw new Error(`Received unexpected projectName: ${amplifyProjectInfo.projectName}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertions are injected into override code with placeholders. This is because overrides don't return anything (or even if they do nothing captures return value).
(this pattern is repeated in other tests, with placeholders in e2e tests and hardcoded values in unit tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question for the old projects using override. Is it mandatory for them to change the override code of adding the new params? Or they can continue staying at the old ones? (when the feature is released in CLI)
There's no action for existing overrides. Additional parameter is ignored at runtime. |
Description of changes
This PR adds additional parameter to the
override()
that has environment name and project name.This is a common functionality that has been implemented across other overrides here aws-amplify/amplify-cli#12064 .
Completes coverage for this ask aws-amplify/amplify-cli#9063 .
CDK / CloudFormation Parameters Changed
Issue #, if available
Description of how you validated changes
https://app.circleci.com/pipelines/github/aws-amplify/amplify-category-api?branch=run-e2e%2Fsobkamil%2Finject-project-info
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.