diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java index 2e7101a52a6..9c97c30a4ed 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java @@ -114,8 +114,8 @@ public static void validateServiceId(String serviceId) { messages.add(String.format("Must not case-insensitively end with `%s`", suffix)); }); - if (serviceId.length() < 2 || serviceId.length() > 50) { - messages.add("Must be between 2 and 50 characters long."); + if (serviceId.isEmpty() || serviceId.length() > 50) { + messages.add("Must be between 1 and 50 characters long."); } if (!messages.isEmpty()) { diff --git a/smithy-aws-traits/src/test/java/software/amazon/smithy/aws/traits/SdkServiceIdValidatorTest.java b/smithy-aws-traits/src/test/java/software/amazon/smithy/aws/traits/SdkServiceIdValidatorTest.java index 0321c121c78..1b6fa22272f 100644 --- a/smithy-aws-traits/src/test/java/software/amazon/smithy/aws/traits/SdkServiceIdValidatorTest.java +++ b/smithy-aws-traits/src/test/java/software/amazon/smithy/aws/traits/SdkServiceIdValidatorTest.java @@ -76,9 +76,9 @@ public void noTrailingWhitespace() { @Test public void doesNotAllowShortIds() { IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> - SdkServiceIdValidator.validateServiceId("F")); + SdkServiceIdValidator.validateServiceId("")); - assertThat(thrown.getMessage(), containsString("2 and 50")); + assertThat(thrown.getMessage(), containsString("1 and 50")); } @Test @@ -86,6 +86,6 @@ public void doesNotAllowLongIds() { IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> SdkServiceIdValidator.validateServiceId("Foobarbazqux Foobarbazqux Foobarbazqux Foobarbazqux")); - assertThat(thrown.getMessage(), containsString("2 and 50")); + assertThat(thrown.getMessage(), containsString("1 and 50")); } }