Mismatch in allowed chars for validator.id in definition v/s suppress trait
It is possible to define a validator with the id containing the dot . character.
metadata validators = [
{
name: "CamelCase",
id:"Camel.Case"
},
However, trying to add a suppress trait for this event ID, like
@suppress(["Camel.Case"])
leads to
Error validating trait `suppress`.0: String value provided for `smithy.api#suppress$member` must match regular expression: ^[_a-zA-Z][A-Za-z0-9]*$
Good catch.
Given that validator suppressions are so restrictive, I think it's fair to clean up the spec and now constrain validator IDs to match suppressions, but also expand what suppressions support match what's been used in practice inside Amazon. I think we should update the suppression trait to allow "."; it should be the same ABNF Smithy uses for shape ID namespaces:
^[_a-zA-Z][A-Za-z0-9_]*(\.[_a-zA-Z][A-Za-z0-9_]*)*$
Then add validation when loading validators to ensure they comply with this regex (see https://github.com/awslabs/smithy/blob/main/smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeId.java#L87). We could repeat the ABNF in the validation spec to not overly couple the concepts.
Actually, I think the more backward compatible change with less potential impact on existing users is to remove the constraints on the @suppress trait rather than constrain validation event IDs. You can define a suppression today using the suppressions metadata key, and that doesn't have any constraints on it. That plus the ID of a validation event make me think the @suppress trait is the outlier and should be updated instead to something more permissive like a non-empty string.