From e4ea9677d69c2746510fcf613e23ff462a509d42 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Wed, 30 Aug 2023 19:36:27 +0200 Subject: [PATCH] fix(core): undeprecate `addWarning` (#26943) Its deprecation is causing problems for `cdk-nag`, which has a use case for unsuppressible warnings. Undeprecate for now until we come up with a better all-round solution. Relates to #26914. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/core/lib/annotations.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/core/lib/annotations.ts b/packages/aws-cdk-lib/core/lib/annotations.ts index 405c3891f0953..19e83f0ec43af 100644 --- a/packages/aws-cdk-lib/core/lib/annotations.ts +++ b/packages/aws-cdk-lib/core/lib/annotations.ts @@ -73,13 +73,16 @@ export class Annotations { } /** - * Adds a warning metadata entry to this construct. + * Adds a warning metadata entry to this construct. Prefer using `addWarningV2`. * * The CLI will display the warning when an app is synthesized, or fail if run - * in --strict mode. + * in `--strict` mode. + * + * Warnings added by this call cannot be acknowledged. This will block users from + * running in `--strict` mode until the deal with the warning, which makes it + * effectively not very different from `addError`. Prefer using `addWarningV2` instead. * * @param message The warning message. - * @deprecated - use addWarningV2 instead */ public addWarning(message: string) { this.addMessage(cxschema.ArtifactMetadataEntryType.WARN, message);