From 915693c095fb4142b6dfd604a5835fcbc8cbeae9 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Wed, 19 Oct 2022 16:11:12 -0700 Subject: [PATCH] Remove pattern from suppress trait entries The suppress trait contained a restrictive pattern trait that was not present in validator ID definitions. This meant that validation events could be suppressed in metadata suppressions (where there was no pattern validation), but not using the `@suppress` trait. Adding the pattern from the `@suppress` trait to validation event IDs at this point has the potential to break existing models, so that is not a desirable alternative. Closes #987 --- .../software/amazon/smithy/model/loader/prelude.smithy | 1 - .../smithy/model/errorfiles/loader/suppression-test.errors | 2 +- .../smithy/model/errorfiles/loader/suppression-test.smithy | 7 ++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/smithy-model/src/main/resources/software/amazon/smithy/model/loader/prelude.smithy b/smithy-model/src/main/resources/software/amazon/smithy/model/loader/prelude.smithy index 3deb96f35f1..703314e969d 100644 --- a/smithy-model/src/main/resources/software/amazon/smithy/model/loader/prelude.smithy +++ b/smithy-model/src/main/resources/software/amazon/smithy/model/loader/prelude.smithy @@ -978,7 +978,6 @@ structure hostLabel {} /// Suppresses validation events by ID for a given shape. @trait list suppress { - @pattern("^[_a-zA-Z][A-Za-z0-9]*$") @length(min: 1) member: String } diff --git a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.errors b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.errors index 33aa0170242..abdbc48e83a 100644 --- a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.errors +++ b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.errors @@ -4,4 +4,4 @@ [SUPPRESSED] smithy.example#List2$member: Members? Yuck! | ListMembersAreBadOkay [SUPPRESSED] -: Unable to locate a validator named `UnknownValidator2` (Please ignore this) | UnknownValidator_UnknownValidator2 [WARNING] -: Unable to locate a validator named `UnknownValidator1` | UnknownValidator_UnknownValidator1 -[SUPPRESSED] smithy.example#MyService: This is suppressed | SuppressedValidator +[SUPPRESSED] smithy.example#MyService: This is suppressed | SuppressedValidator.Foo diff --git a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.smithy b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.smithy index 0d0a3efb74c..6430795695f 100644 --- a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.smithy +++ b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/loader/suppression-test.smithy @@ -21,7 +21,7 @@ metadata validators = [ { // This one is suppressed. name: "EmitEachSelector", - id: "SuppressedValidator", + id: "SuppressedValidator.Foo", message: "This is suppressed", severity: "WARNING", configuration: { @@ -43,11 +43,11 @@ metadata suppressions = [ reason: "Please ignore this", }, { - id: "SuppressedValidator", + id: "SuppressedValidator.Foo", namespace: "smithy.example.ignore.this.one", // matches nothing }, { - id: "SuppressedValidator", + id: "SuppressedValidator.Foo", namespace: "smithy.example" }, ] @@ -60,6 +60,7 @@ service MyService { operations: [GetFoo], } +@suppress(["IgnoreMe.Too"]) operation GetFoo { input: GetFooInput, output: GetFooOutput