refactor(core): build every Smithy validation error through SmithyValidationErrors (#5910)

SmithyValidationErrors gains named factories for the three common codes
(validationException, validationError, badRequest) and a single-violation
overload of each. The "N validation errors detected" builders outside SES
(CloudFormation, Cognito, DynamoDB, EventBridge, Firehose, IAM, IoT, KMS,
Lambda, Rekognition, SSM) and the remaining hand-written
"1 validation error detected" messages in SES move onto it. No message
changes.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-10-18 00:47:55 -04:00
1 parent 63af5cd299
commit b55014ddef
38 files changed
+212 -187

No files matched your search

@@ -12,6 +12,10 @@ public final class SmithyValidationErrors {
private SmithyValidationErrors() {}
/**
* The message for one or more violations. An empty list is the caller's bug, so it fails rather
* than answering "0 validation errors"; check {@code isEmpty()} before throwing.
*/
public static String message(List<String> violations) {
if (violations.isEmpty()) {
throw new IllegalArgumentException("no violations to report");
@@ -26,4 +30,35 @@ public final class SmithyValidationErrors {
public static AwsException exception(String errorCode, List<String> violations) {
return new AwsException(errorCode, message(violations), 400);
}
public static AwsException exception(String errorCode, String violation) {
return exception(errorCode, List.of(violation));
}
/** The code most JSON services use, on both the awsJson and the restJson protocols. */
public static AwsException validationException(List<String> violations) {
return exception("ValidationException", violations);
}
public static AwsException validationException(String violation) {
return validationException(List.of(violation));
}
/** The awsQuery protocol's code. */
public static AwsException validationError(List<String> violations) {
return exception("ValidationError", violations);
}
public static AwsException validationError(String violation) {
return validationError(List.of(violation));
}
/** The code of REST JSON services that model their validation failure as BadRequestException. */
public static AwsException badRequest(List<String> violations) {
return exception("BadRequestException", violations);
}
public static AwsException badRequest(String violation) {
return badRequest(List.of(violation));
}
}
@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.core.common.AwsPartitions;
import io.github.hectorvent.floci.core.common.AwsRegions;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.RequestScopes;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.common.dns.EmbeddedDnsServer;
import io.github.hectorvent.floci.core.resource.ExplorerResource;
import io.github.hectorvent.floci.core.resource.ResourceProvider;
@@ -1426,10 +1427,7 @@ public class CloudFormationService implements ResourceProvider {
+ RESOURCE_TO_SKIP.pattern() + "]");
}
if (!violations.isEmpty()) {
String prefix = violations.size() == 1
? "1 validation error detected: "
: violations.size() + " validation errors detected: ";
throw new AwsException("ValidationError", prefix + String.join("; ", violations), 400);
throw SmithyValidationErrors.validationError(violations);
}
}
@@ -19,6 +19,7 @@ import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.ReservedTags;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.resource.ExplorerResource;
import io.github.hectorvent.floci.core.resource.ResourceProvider;
import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@@ -2070,10 +2071,7 @@ public class CognitoService implements ResourceProvider {
}
private AwsException validationErrors(List<String> errors) {
String header = errors.size() == 1
? "1 validation error detected: "
: errors.size() + " validation errors detected: ";
return new AwsException("InvalidParameterException", header + String.join("; ", errors), 400);
return SmithyValidationErrors.exception("InvalidParameterException", errors);
}
/** Mirrors the request model's {@code toString}, which AWS embeds in the length-constraint message. */
@@ -3103,10 +3101,7 @@ public class CognitoService implements ResourceProvider {
if (errors.isEmpty()) {
return;
}
String header = errors.size() == 1
? "1 validation error detected: "
: errors.size() + " validation errors detected: ";
throw new AwsException("InvalidParameterException", header + String.join("; ", errors), 400);
throw validationErrors(errors);
}
/** Mirrors the request model's {@code toString}, which AWS embeds in the length-constraint message. */
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsErrorResponse;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.dynamodb.NativeDynamoDbTableService.CreateTableRequest;
import io.github.hectorvent.floci.services.dynamodb.NativeDynamoDbTableService.GsiThroughputUpdate;
import io.github.hectorvent.floci.services.dynamodb.NativeDynamoDbTableService.KinesisDestination;
@@ -573,10 +574,7 @@ public class NativeDynamoDbJsonHandler {
+ "Member must satisfy enum value set: [NONE, ALL_OLD]");
}
if (!validationErrors.isEmpty()) {
int n = validationErrors.size();
throw new AwsException("ValidationException",
n + " validation error" + (n > 1 ? "s" : "") + " detected: "
+ String.join("; ", validationErrors), 400);
throw SmithyValidationErrors.validationException(validationErrors);
}
DynamoDbExpressionSize.checkWrite(conditionExpression, "ConditionExpression");
DynamoDbAttributeValueValidator.requireNestingWithinLimit(item);
@@ -699,10 +697,7 @@ public class NativeDynamoDbJsonHandler {
+ "Member must satisfy enum value set: [NONE, ALL_OLD]");
}
if (!delValidationErrors.isEmpty()) {
int n = delValidationErrors.size();
throw new AwsException("ValidationException",
n + " validation error" + (n > 1 ? "s" : "") + " detected: "
+ String.join("; ", delValidationErrors), 400);
throw SmithyValidationErrors.validationException(delValidationErrors);
}
DynamoDbExpressionSize.checkWrite(conditionExpression, "ConditionExpression");
DynamoDbAttributeValueValidator.requireNestingWithinLimit(exprAttrValues);
@@ -2022,10 +2017,7 @@ public class NativeDynamoDbJsonHandler {
if (validationErrors.isEmpty()) {
return;
}
int n = validationErrors.size();
throw new AwsException("ValidationException",
n + " validation error" + (n > 1 ? "s" : "") + " detected: "
+ String.join("; ", validationErrors), 400);
throw SmithyValidationErrors.validationException(validationErrors);
}
private Response transactWriteCanceled(TransactionCanceledException e) {
@@ -13,6 +13,7 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.resource.ExplorerResource;
import io.github.hectorvent.floci.core.resource.ResourceProvider;
import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@@ -1320,10 +1321,7 @@ public class EventBridgeService implements ResourceProvider {
+ "Member must have length less than or equal to 4096");
}
if (!violations.isEmpty()) {
String header = violations.size() == 1
? "1 validation error detected: "
: violations.size() + " validation errors detected: ";
throw new AwsException("ValidationException", header + String.join("; ", violations), 400);
throw SmithyValidationErrors.validationException(violations);
}
}
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.firehose;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription;
import io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.OpenXJsonSerDe;
import io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.OrcSerDe;
@@ -418,9 +419,6 @@ final class S3DestinationValidator {
}
private static AwsException constraintViolations(List<String> violations) {
String header = violations.size() == 1
? "1 validation error detected: "
: violations.size() + " validation errors detected: ";
return new AwsException("ValidationException", header + String.join("; ", violations), 400);
return SmithyValidationErrors.validationException(violations);
}
}
@@ -17,6 +17,7 @@ import io.github.hectorvent.floci.core.common.Pem;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.ServicePrincipals;
import io.github.hectorvent.floci.core.common.SessionAccountLookup;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.common.SshPublicKeyException;
import io.github.hectorvent.floci.core.common.SshPublicKeys;
import io.github.hectorvent.floci.core.common.Totp;
@@ -3856,18 +3857,9 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
if (violations.isEmpty()) {
return;
}
StringBuilder message = new StringBuilder()
.append(violations.size())
.append(violations.size() == 1 ? " validation error detected: "
: " validation errors detected: ");
for (int i = 0; i < violations.size(); i++) {
if (i > 0) {
message.append("; ");
}
message.append("Value at 'serviceSpecificCredentialId' failed to satisfy constraint: ")
.append(violations.get(i));
}
throw new AwsException("ValidationError", message.toString(), 400);
throw SmithyValidationErrors.validationError(violations.stream()
.map(violation -> "Value at 'serviceSpecificCredentialId' failed to satisfy constraint: " + violation)
.toList());
}
/** AWS's wording for an id that matches the pattern and no credential. */
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.iot.model.IotAuthorizer;
@@ -27,7 +28,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* AWS IoT Core custom authorizers: the records CreateAuthorizer and its peers manage, and the
@@ -392,10 +392,9 @@ public class IotAuthorizerService {
}
private static AwsException constraints(String field, List<String> constraints) {
return invalid(constraints.size() + " validation error" + (constraints.size() == 1 ? "" : "s") + " detected: "
+ constraints.stream()
.map(constraint -> "Value at '" + field + "' failed to satisfy constraint: " + constraint)
.collect(Collectors.joining("; ")));
return invalid(SmithyValidationErrors.message(constraints.stream()
.map(constraint -> "Value at '" + field + "' failed to satisfy constraint: " + constraint)
.toList()));
}
static AwsException invalid(String message) {
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.node.MissingNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.iot.model.IotIndexingConfiguration;
@@ -456,8 +457,7 @@ public class IotFleetIndexingService {
private static void rejectViolations(List<String> errors) {
if (!errors.isEmpty()) {
throw invalid(errors.size() + (errors.size() == 1 ? " validation error" : " validation errors")
+ " detected: " + String.join("; ", errors));
throw invalid(SmithyValidationErrors.message(errors));
}
}
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.AwsErrorResponse;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.ReservedTags;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.kms.model.KmsAlias;
import io.github.hectorvent.floci.services.kms.model.KmsGrant;
import io.github.hectorvent.floci.services.kms.model.KmsKey;
@@ -713,11 +714,11 @@ public class KmsJsonHandler {
String pattern = "Value '" + keyId + "' at '" + name
+ "' failed to satisfy constraint: Member must satisfy regular expression pattern: ^\\p{ASCII}+$";
if (keyId.isEmpty()) {
throw new AwsException("ValidationException", "2 validation errors detected: Value '' at '" + name
+ "' failed to satisfy constraint: Member must have length greater than or equal to 1; " + pattern, 400);
throw SmithyValidationErrors.validationException(List.of("Value '' at '" + name
+ "' failed to satisfy constraint: Member must have length greater than or equal to 1", pattern));
}
if (!keyId.chars().allMatch(c -> c < 128)) {
throw new AwsException("ValidationException", "1 validation error detected: " + pattern, 400);
throw SmithyValidationErrors.validationException(pattern);
}
}
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.lambda.model.LambdaLayerVersion;
import io.github.hectorvent.floci.services.lambda.zip.ZipExtractor;
import io.github.hectorvent.floci.services.s3.S3Service;
@@ -328,9 +329,7 @@ public class LambdaLayerService {
"Member must satisfy enum value set: " + COMPATIBLE_ARCHITECTURES));
}
if (!errors.isEmpty()) {
throw new AwsException("ValidationException",
errors.size() + (errors.size() == 1 ? " validation error" : " validation errors")
+ " detected: " + String.join("; ", errors), 400);
throw SmithyValidationErrors.validationException(errors);
}
return parsed;
}
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.Resettable;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend.AccountEntry;
import io.github.hectorvent.floci.core.storage.StorageFactory;
@@ -1121,9 +1122,7 @@ public class DurableExecutionService implements Resettable {
/** AWS reports every invalid member of a request in one ValidationException. */
static AwsException validationError(List<String> violations) {
String count = violations.size() == 1 ? "1 validation error detected: "
: violations.size() + " validation errors detected: ";
return new AwsException("ValidationException", count + String.join("; ", violations), 400);
return SmithyValidationErrors.validationException(violations);
}
private static AwsException invalidMarker() {
@@ -1,6 +1,6 @@
package io.github.hectorvent.floci.services.lambdaweb;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import java.util.ArrayList;
import java.util.List;
@@ -139,7 +139,6 @@ final class LambdaWebValidation {
if (errors.isEmpty()) {
return;
}
String head = errors.size() == 1 ? "1 validation error detected: " : errors.size() + " validation errors detected: ";
throw new AwsException("ValidationException", head + String.join("; ", errors), 400);
throw SmithyValidationErrors.validationException(errors);
}
}
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.rekognition;
import com.fasterxml.jackson.databind.JsonNode;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.s3.S3Service;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
@@ -145,9 +146,7 @@ public class RekognitionImageValidator {
}
}
if (!violations.isEmpty()) {
String count = violations.size() == 1 ? "1 validation error" : violations.size() + " validation errors";
throw new AwsException("ValidationException",
count + " detected: " + String.join("; ", violations), 400);
throw SmithyValidationErrors.validationException(violations);
}
}
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.ses.model.AccountSuppressionAttributes;
import io.github.hectorvent.floci.services.ses.model.AccountVdmAttributes;
import jakarta.inject.Inject;
@@ -280,9 +281,9 @@ public class SesAccountController {
JsonNode node = parent.path(field);
if (node.isMissingNode() || node.isNull()) {
if (required) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value null at '" + path
+ "' failed to satisfy constraint: Member must not be null", 400);
throw SmithyValidationErrors.badRequest(
"Value null at '" + path
+ "' failed to satisfy constraint: Member must not be null");
}
return false;
}
@@ -295,9 +296,8 @@ public class SesAccountController {
return false;
}
}
throw new AwsException("BadRequestException",
"1 validation error detected: Value at '" + path
+ "' failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]",
400);
throw SmithyValidationErrors.badRequest(
"Value at '" + path
+ "' failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]");
}
}
@@ -200,7 +200,7 @@ public class SesAccountService {
}
}
if (!errors.isEmpty()) {
throw SmithyValidationErrors.exception("BadRequestException", errors);
throw SmithyValidationErrors.badRequest(errors);
}
if (!isValidUrl(websiteUrl)) {
throw new AwsException("BadRequestException", "Url contains invalid format", 400);
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.ses.model.ArchivingOptions;
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
import io.github.hectorvent.floci.services.ses.model.DashboardOptions;
@@ -464,10 +465,10 @@ public class SesConfigurationSetController {
if (format == null) {
format = SIGNATURE_FORMAT_DETACHED;
} else if (!SIGNATURE_FORMAT_DETACHED.equals(format)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at "
throw SmithyValidationErrors.badRequest(
"Value at "
+ "'messageSecurityOptions.signingScheme.smimeScheme.signatureFormat' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [DETACHED]", 400);
+ "satisfy constraint: Member must satisfy enum value set: [DETACHED]");
}
return new MessageSecurityOptions(SigningScheme.smime(format));
}
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.ses.model.ArchivingOptions;
@@ -96,12 +97,11 @@ public class SesConfigurationSetService implements SesTaggable {
invalidSuppressionReasonMessage(null), 400);
}
if (!isValidSuppressionReason(reason)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at "
throw SmithyValidationErrors.badRequest(
"Value at "
+ "'suppressionOptions.suppressedReasons' failed to satisfy "
+ "constraint: Member must satisfy constraint: "
+ "[Member must satisfy enum value set: [BOUNCE, COMPLAINT]]",
400);
+ "[Member must satisfy enum value set: [BOUNCE, COMPLAINT]]");
}
}
}
@@ -230,9 +230,9 @@ public class SesConfigurationSetService implements SesTaggable {
"Domain <" + domain + "> is not verified under this account.", 400);
}
if (httpsPolicy != null && !HTTPS_POLICIES.contains(httpsPolicy)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'httpsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE, REQUIRE_OPEN_ONLY]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'httpsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE, REQUIRE_OPEN_ONLY]");
}
}
@@ -242,9 +242,9 @@ public class SesConfigurationSetService implements SesTaggable {
return;
}
if (options.getTlsPolicy() != null && !TLS_POLICIES.contains(options.getTlsPolicy())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'tlsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'tlsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE]");
}
// AWS rejects a blank SendingPoolName outright, and a non-existent
// dedicated IP pool (both verified against real AWS 2026-06-17). The
@@ -264,14 +264,14 @@ public class SesConfigurationSetService implements SesTaggable {
if (options.getMaxDeliverySeconds() != null) {
long maxDeliverySeconds = options.getMaxDeliverySeconds();
if (maxDeliverySeconds < 300) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value greater than or equal to 300", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value greater than or equal to 300");
}
if (maxDeliverySeconds > 50400) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value less than or equal to 50400", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value less than or equal to 50400");
}
}
}
@@ -279,9 +279,9 @@ public class SesConfigurationSetService implements SesTaggable {
void requireVerifiedRedirectDomain(String domain, Predicate<String> verifiedDomainIdentity) {
Objects.requireNonNull(verifiedDomainIdentity, "verifiedDomainIdentity probe is required");
if (domain == null) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'trackingOptions' failed to satisfy constraint: "
+ "Member must not be null", 400);
throw SmithyValidationErrors.validationError(
"Value at 'trackingOptions' failed to satisfy constraint: "
+ "Member must not be null");
}
if (domain.isBlank()) {
throw new AwsException("InvalidTrackingOptions",
@@ -460,16 +460,16 @@ public class SesConfigurationSetService implements SesTaggable {
if (options.getDashboardOptions() != null
&& options.getDashboardOptions().getEngagementMetrics() != null
&& !VDM_FEATURE_STATES.contains(options.getDashboardOptions().getEngagementMetrics())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'vdmOptions.dashboardOptions.engagementMetrics' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'vdmOptions.dashboardOptions.engagementMetrics' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]");
}
if (options.getGuardianOptions() != null
&& options.getGuardianOptions().getOptimizedSharedDelivery() != null
&& !VDM_FEATURE_STATES.contains(options.getGuardianOptions().getOptimizedSharedDelivery())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'vdmOptions.guardianOptions.optimizedSharedDelivery' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'vdmOptions.guardianOptions.optimizedSharedDelivery' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]");
}
}
@@ -218,8 +218,8 @@ public class SesContactService implements SesTaggable {
// SES V2 surfaces missing/invalid input as Smithy validation errors. Field paths and the
// enum value order are taken verbatim from real AWS.
private static AwsException validationError(String fieldPath, String constraint) {
return SmithyValidationErrors.exception("BadRequestException",
List.of("Value at '" + fieldPath + "' failed to satisfy constraint: " + constraint));
return SmithyValidationErrors.badRequest(
"Value at '" + fieldPath + "' failed to satisfy constraint: " + constraint);
}
private static void validateContactListName(String name) {
@@ -92,7 +92,7 @@ final class SesExportFilters {
requireFilterBlock(insights.path("Include"), "include", violations);
requireFilterBlock(insights.path("Exclude"), "exclude", violations);
if (!violations.isEmpty()) {
throw SmithyValidationErrors.exception("BadRequestException", violations);
throw SmithyValidationErrors.badRequest(violations);
}
}
@@ -143,9 +143,9 @@ public class SesExportJobService implements Resettable {
throw notNull("exportDestination.dataFormat");
}
if (!DATA_FORMATS.contains(dataFormat)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'exportDestination.dataFormat' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [CSV, JSON]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'exportDestination.dataFormat' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [CSV, JSON]");
}
// Probe-confirmed order: the data source and the destination's own constraints are checked
// first, then the refusal of a caller-chosen destination, then the VDM gate.
@@ -388,16 +388,16 @@ public class SesExportJobService implements Resettable {
/** Newest first, as SES lists them; the paged list resumes on the same order. */
public List<ExportJob> listExportJobs(String region, String sourceType, String jobStatus) {
if (sourceType != null && !SOURCE_TYPES.contains(sourceType)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'exportSourceType' failed to satisfy "
throw SmithyValidationErrors.badRequest(
"Value at 'exportSourceType' failed to satisfy "
+ "constraint: Member must satisfy enum value set: "
+ "[METRICS_DATA, MESSAGE_INSIGHTS]", 400);
+ "[METRICS_DATA, MESSAGE_INSIGHTS]");
}
if (jobStatus != null && !JOB_STATUSES.contains(jobStatus)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'jobStatus' failed to satisfy "
throw SmithyValidationErrors.badRequest(
"Value at 'jobStatus' failed to satisfy "
+ "constraint: Member must satisfy enum value set: "
+ "[CREATED, PROCESSING, COMPLETED, FAILED, CANCELLED]", 400);
+ "[CREATED, PROCESSING, COMPLETED, FAILED, CANCELLED]");
}
return exportJobStore.scan(k -> k.startsWith(keyPrefix(region))).stream()
.filter(job -> sourceType == null || sourceType.equals(job.getExportSourceType()))
@@ -540,8 +540,8 @@ public class SesExportJobService implements Resettable {
}
private static AwsException notNull(String member) {
return SmithyValidationErrors.exception("BadRequestException",
List.of("Value at '" + member + "' failed to satisfy constraint: Member must not be null"));
return SmithyValidationErrors.badRequest(
"Value at '" + member + "' failed to satisfy constraint: Member must not be null");
}
/**
@@ -556,21 +556,21 @@ public class SesExportJobService implements Resettable {
return;
}
if (maxResults < 1 || maxResults > MAX_RESULTS) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at "
throw SmithyValidationErrors.badRequest(
"Value at "
+ "'exportDataSource.messageInsightsDataSource.maxResults' failed to "
+ "satisfy constraint: Member must be between 1 and " + MAX_RESULTS
+ ", inclusive", 400);
+ ", inclusive");
}
}
private static Instant requireDate(JsonNode source, String field) {
Instant value = date(source, field);
if (value == null) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at '" + field.substring(0, 1).toLowerCase(Locale.ROOT)
throw SmithyValidationErrors.badRequest(
"Value at '" + field.substring(0, 1).toLowerCase(Locale.ROOT)
+ field.substring(1) + "' failed to satisfy constraint: "
+ "Member must not be null", 400);
+ "Member must not be null");
}
return value;
}
@@ -70,7 +70,7 @@ final class SesExportMetrics {
}
validateMetrics(metrics.path("Metrics"), violations);
if (!violations.isEmpty()) {
throw SmithyValidationErrors.exception("BadRequestException", violations);
throw SmithyValidationErrors.badRequest(violations);
}
}
@@ -349,7 +349,7 @@ public class SesIdentityCertificateService {
if (violations.isEmpty()) {
return;
}
throw SmithyValidationErrors.exception("BadRequestException", violations);
throw SmithyValidationErrors.badRequest(violations);
}
private static AwsException badRequest(String message) {
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.ses.model.Identity;
import io.github.hectorvent.floci.services.ses.model.Tag;
import jakarta.inject.Inject;
@@ -284,9 +285,9 @@ public class SesIdentityController {
JsonNode policyNode = request.path("Policy");
if (policyNode.isMissingNode() || policyNode.isNull()) {
// Verified against AWS: a missing/null required member is a Smithy validation error.
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'policy' failed to satisfy constraint: "
+ "Member must not be null", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'policy' failed to satisfy constraint: "
+ "Member must not be null");
}
if (!policyNode.isTextual()) {
// Policy is a String; AWS rejects a non-string with an empty-bodied 400. Don't coerce
@@ -561,9 +562,9 @@ public class SesIdentityController {
if ("USE_DEFAULT_VALUE".equals(v2)) {
return "UseDefaultValue";
}
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'behaviorOnMxFailure' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [REJECT_MESSAGE, USE_DEFAULT_VALUE]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'behaviorOnMxFailure' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [REJECT_MESSAGE, USE_DEFAULT_VALUE]");
}
private ObjectNode buildDkimAttributes(Identity identity, String region) {
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ses;
import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.route53.Route53Service;
@@ -350,9 +351,9 @@ public class SesIdentityService implements SesTaggable {
if (behaviorOnMxFailure != null) {
if (!"UseDefaultValue".equals(behaviorOnMxFailure)
&& !"RejectMessage".equals(behaviorOnMxFailure)) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'behaviorOnMXFailure' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [RejectMessage, UseDefaultValue]", 400);
throw SmithyValidationErrors.validationError(
"Value at 'behaviorOnMXFailure' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [RejectMessage, UseDefaultValue]");
}
normalizedBehavior = behaviorOnMxFailure;
}
@@ -468,10 +469,10 @@ public class SesIdentityService implements SesTaggable {
"NotificationType is required.", 400);
}
if (!NOTIFICATION_TYPES.contains(notificationType)) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'notificationType' failed to satisfy "
throw SmithyValidationErrors.validationError(
"Value at 'notificationType' failed to satisfy "
+ "constraint: Member must satisfy enum value set: "
+ NOTIFICATION_TYPES, 400);
+ NOTIFICATION_TYPES);
}
synchronized (identityCreationLock) {
Identity identity = identityStore.get(identityKey(region, identityValue))
@@ -470,8 +470,8 @@ public class SesImportJobService implements Resettable {
}
private static AwsException validationError(String path, String constraint) {
return SmithyValidationErrors.exception("BadRequestException",
List.of("Value at '" + path + "' failed to satisfy constraint: " + constraint));
return SmithyValidationErrors.badRequest(
"Value at '" + path + "' failed to satisfy constraint: " + constraint);
}
static String key(String region, String jobId) {
@@ -113,7 +113,7 @@ public enum SesListPaging {
* default could not be measured and is taken to be the bound.
*/
V2_LIST_EMAIL_IDENTITY_CERTIFICATES(Namespace.IDENTITY_CERTIFICATE, 1000, 1000,
size -> badRequest("1 validation error detected: Value '" + size + "' at 'pageSize' failed to "
size -> SmithyValidationErrors.badRequest("Value '" + size + "' at 'pageSize' failed to "
+ "satisfy constraint: Member must have value "
+ (size < 1 ? "greater than or equal to 1" : "less than or equal to 1000")),
token -> badRequest("Invalid NextToken."),
@@ -179,19 +179,19 @@ public enum SesListPaging {
}
static AwsException pageSizeError(int pageSize) {
return SmithyValidationErrors.exception("BadRequestException", List.of(pageSizeViolation(pageSize)));
return SmithyValidationErrors.badRequest(pageSizeViolation(pageSize));
}
static AwsException tokenError(String token) {
if (token.isEmpty()) {
return SmithyValidationErrors.exception("BadRequestException", List.of(EMPTY_TOKEN));
return SmithyValidationErrors.badRequest(EMPTY_TOKEN);
}
return badRequest("Invalid Next Token");
}
/** SES lists the token before the page size. */
static AwsException bothError(int pageSize) {
return SmithyValidationErrors.exception("BadRequestException",
return SmithyValidationErrors.badRequest(
List.of(EMPTY_TOKEN, pageSizeViolation(pageSize)));
}
}
@@ -371,6 +371,6 @@ public class SesMetricsController {
}
private static AwsException aggregated(List<String> violations) {
return SmithyValidationErrors.exception("BadRequestException", violations);
return SmithyValidationErrors.badRequest(violations);
}
}
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ses;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import jakarta.enterprise.context.ApplicationScoped;
@@ -172,9 +173,9 @@ public class SesPolicyService {
throw new AwsException("InvalidParameterValue", "PolicyName is required.", 400);
}
if (policyName.length() > 64) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'policyName' failed to satisfy constraint: "
+ "Member must have length less than or equal to 64", 400);
throw SmithyValidationErrors.validationError(
"Value at 'policyName' failed to satisfy constraint: "
+ "Member must have length less than or equal to 64");
}
if (!POLICY_NAME_CHARS.matcher(policyName).matches()) {
throw new AwsException("InvalidParameterValue",
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.AwsNamespaces;
import io.github.hectorvent.floci.core.common.AwsQueryResponse;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.common.XmlBuilder;
import io.github.hectorvent.floci.services.ses.address.SesAddressSyntax;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
@@ -1041,10 +1042,9 @@ public class SesQueryHandler {
// here so an invalid enum value yields the v1 ValidationError AWS returns rather than the
// shared service's v2-style BadRequestException. Message verified against real AWS.
if (tlsPolicy != null && !"Require".equals(tlsPolicy) && !"Optional".equals(tlsPolicy)) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'deliveryOptions.tlsPolicy' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [Optional, Require]",
400);
throw SmithyValidationErrors.validationError(
"Value at 'deliveryOptions.tlsPolicy' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [Optional, Require]");
}
// Mirror the V2 path: an all-null DeliveryOptions clears the block rather than
// persisting an empty object. Normalize the value to the V2 canonical REQUIRE/OPTIONAL
@@ -484,7 +484,7 @@ public class SesReceiptRuleService {
if (violations.isEmpty()) {
return;
}
throw SmithyValidationErrors.exception("ValidationError", violations);
throw SmithyValidationErrors.validationError(violations);
}
/**
@@ -732,9 +732,9 @@ public class SesReceiptRuleService {
if (filterName == null) {
// Probed: an absent FilterName is the one case the wire rejects; deleting a missing
// or malformed name succeeds without error.
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'filterName' failed to satisfy "
+ "constraint: Member must not be null", 400);
throw SmithyValidationErrors.validationError(
"Value at 'filterName' failed to satisfy "
+ "constraint: Member must not be null");
}
receiptFilterStore.delete(receiptFilterKey(region, filterName));
LOG.infov("Deleted SES receipt filter: {0} in region {1}", filterName, region);
@@ -751,8 +751,8 @@ public class SesReceiptRuleService {
*/
private static void validateFilterShape(ReceiptFilter filter) {
if (filter == null) {
throw new AwsException("ValidationError",
"1 validation error detected: " + notNullViolation("filter"), 400);
throw SmithyValidationErrors.validationError(
notNullViolation("filter"));
}
List<String> violations = new ArrayList<>();
if (filter.getName() == null) {
@@ -773,7 +773,7 @@ public class SesReceiptRuleService {
}
}
if (!violations.isEmpty()) {
throw SmithyValidationErrors.exception("ValidationError", violations);
throw SmithyValidationErrors.validationError(violations);
}
}
@@ -900,9 +900,9 @@ public class SesReceiptRuleService {
throw new AwsException("InvalidParameterValue", "RuleSetName is required.", 400);
}
if (!RULE_SET_NAME_CHARS.matcher(name).matches()) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'ruleSetName' failed to satisfy constraint: "
+ "Member must satisfy regular expression pattern: ^[a-zA-Z0-9_.-]+$", 400);
throw SmithyValidationErrors.validationError(
"Value at 'ruleSetName' failed to satisfy constraint: "
+ "Member must satisfy regular expression pattern: ^[a-zA-Z0-9_.-]+$");
}
requireValidRuleSetName(name);
}
@@ -588,8 +588,8 @@ public class SesSendController {
private static AwsException constraintViolation(String value, String path, String constraint) {
String subject = value == null ? "Value" : "Value '" + value + "'";
return SmithyValidationErrors.exception("BadRequestException",
List.of(subject + " at '" + path + "' failed to satisfy constraint: " + constraint));
return SmithyValidationErrors.badRequest(
subject + " at '" + path + "' failed to satisfy constraint: " + constraint);
}
private static AwsException missingHeaderMember(String location, int index, String member) {
@@ -614,7 +614,7 @@ public class SesSendController {
violations.add(trackingViolation("openTrackingEnabled"));
}
if (!violations.isEmpty()) {
throw SmithyValidationErrors.exception("BadRequestException", violations);
throw SmithyValidationErrors.badRequest(violations);
}
}
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ses;
import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.ses.model.AccountSuppressionAttributes;
@@ -339,9 +340,9 @@ public class SesSuppressionService {
String constraint = nested
? "Member must satisfy constraint: [Member must satisfy enum value set: [BOUNCE, COMPLAINT]]"
: "Member must satisfy enum value set: [BOUNCE, COMPLAINT]";
throw new AwsException("BadRequestException",
"1 validation error detected: Value at '" + fieldName + "' failed to satisfy constraint: "
+ constraint, 400);
throw SmithyValidationErrors.badRequest(
"Value at '" + fieldName + "' failed to satisfy constraint: "
+ constraint);
}
}
}
@@ -85,7 +85,7 @@ final class SesTags {
}
}
if (!lengthErrors.isEmpty()) {
throw SmithyValidationErrors.exception("BadRequestException", lengthErrors);
throw SmithyValidationErrors.badRequest(lengthErrors);
}
// An empty key is rejected with an empty body, matching AWS.
for (Tag tag : tags) {
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.ses.model.Tag;
@@ -378,9 +379,9 @@ public class SesTenantService implements SesTaggable {
*/
public static AssociationResource parseResourceArn(String resourceArn, String accountId, String region) {
if (resourceArn == null) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'resourceArn' failed to satisfy constraint: "
+ "Member must not be null", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'resourceArn' failed to satisfy constraint: "
+ "Member must not be null");
}
String[] parts = resourceArn.split(":", 6);
if (parts.length < 6 || !"arn".equals(parts[0])) {
@@ -613,9 +614,9 @@ public class SesTenantService implements SesTaggable {
}
if (suppressionScope != null && !"TENANT".equals(suppressionScope)
&& !"ACCOUNT".equals(suppressionScope)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'suppressionScope' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [TENANT, ACCOUNT]", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'suppressionScope' failed to satisfy "
+ "constraint: Member must satisfy enum value set: [TENANT, ACCOUNT]");
}
if (suppressedReasons != null) {
Set<String> seen = new HashSet<>();
@@ -649,17 +650,17 @@ public class SesTenantService implements SesTaggable {
private static void validateTenantName(String name, boolean createTenantSmithyVariants) {
if (name == null) {
if (createTenantSmithyVariants) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'tenantName' failed to satisfy "
+ "constraint: Member must not be null", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'tenantName' failed to satisfy "
+ "constraint: Member must not be null");
}
throw new AwsException("BadRequestException", "TenantName cannot be empty", 400);
}
if (name.isEmpty()) {
if (createTenantSmithyVariants) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'tenantName' failed to satisfy "
+ "constraint: Member must have length greater than or equal to 1", 400);
throw SmithyValidationErrors.badRequest(
"Value at 'tenantName' failed to satisfy "
+ "constraint: Member must have length greater than or equal to 1");
}
throw new AwsException("BadRequestException", "TenantName cannot be empty", 400);
}
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.ses.model.Tag;
import java.time.Instant;
@@ -198,14 +199,14 @@ final class SesV2Json {
return Map.of();
}
if (!keys.containsAll(filter.keySet())) {
throw new AwsException("BadRequestException", "1 validation error detected: Value at 'filter' "
throw SmithyValidationErrors.badRequest( "Value at 'filter' "
+ "failed to satisfy constraint: Map keys must satisfy constraint: "
+ "[Member must satisfy enum value set: [" + String.join(", ", keys) + "]]", 400);
+ "[Member must satisfy enum value set: [" + String.join(", ", keys) + "]]");
}
if (filter.containsValue("")) {
throw new AwsException("BadRequestException", "1 validation error detected: Value at 'filter' "
throw SmithyValidationErrors.badRequest( "Value at 'filter' "
+ "failed to satisfy constraint: Map value must satisfy constraint: "
+ "[Member must have length greater than or equal to 1]", 400);
+ "[Member must have length greater than or equal to 1]");
}
Map<String, String> values = new LinkedHashMap<>();
filter.forEach((key, value) -> {
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.DeadlineCharSequence;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.core.resource.ExplorerResource;
import io.github.hectorvent.floci.core.resource.ResourceProvider;
import io.github.hectorvent.floci.core.resource.SupportedResourceType;
@@ -871,10 +872,7 @@ public class SsmService implements ResourceProvider {
}
static AwsException validationErrors(List<String> violations) {
String count = violations.size() == 1
? "1 validation error detected: "
: violations.size() + " validation errors detected: ";
return new AwsException("ValidationException", count + String.join("; ", violations), 400);
return SmithyValidationErrors.validationException(violations);
}
private static boolean isValidLabel(String label) {