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(core): facility to warn when deprecated APIs are used #9585

Merged
merged 21 commits into from
Aug 20, 2020

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Aug 11, 2020

Introduce Annotations.addDeprecation() which will attach a warning to the construct indicating that a deprecated API is used.

At the moment, we only use this to warn when .node is used instead of .construct, but we will gradually use this to report the usage of all deprecated APIs as a preparation for v2.0.

If the environment variable CDK_BLOCK_DEPRECATIONS is set (and it is set in cdk-test), it will cause usage of deprecated APIs to throw an error instead.

Related: aws/aws-cdk-rfcs#192


Build will be failing until #9584 is merged


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

Introduce `Annotations.addDeprecation()` which will attach a warning to the construct indicating that a deprecated API is used.

At the moment, we only use this to warn when `.node` is used instead of `.construct`, but we will gradually use this to report the usage of all deprecated APIs as a preparation for v2.0.

If the environment variable `CDK_BLOCK_DEPRECATIONS` is set (and it is set in `cdk-test`), it will cause usage of deprecated APIs to throw an error instead.

Related: aws/aws-cdk-rfcs#192
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 11, 2020
@eladb eladb requested review from rix0rrr, nija-at and a team August 11, 2020 08:32
packages/@aws-cdk/core/lib/annotations.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/core/lib/annotations.ts Show resolved Hide resolved
packages/@aws-cdk/core/lib/construct-compat.ts Outdated Show resolved Hide resolved
Elad Ben-Israel and others added 2 commits August 11, 2020 12:44
@eladb eladb changed the title feat(core): facility to warn when using deprecated apis feat(core): facility to warn when deprecated APIs are used Aug 11, 2020
@eladb eladb requested a review from nija-at August 11, 2020 10:51
@eladb eladb added the pr-linter/exempt-readme The PR linter will not require README changes label Aug 11, 2020
@eladb eladb self-assigned this Aug 11, 2020
@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d26c964
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit b1d0ac0 into master Aug 20, 2020
@mergify mergify bot deleted the benisrae/add-deprecations branch August 20, 2020 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants