Light, fluffy, and always free - The AWS Local Emulator alternative
refactor: build every not-null violation with SmithyValidationErrors.notNull (#6439)
Priamo Germosen998276b8f55e
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/TagDispatcher.java b/src/main/java/io/github/hectorvent/floci/core/common/TagDispatcher.javaindex 53f52a5248..ecfa2c82a4 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/TagDispatcher.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/TagDispatcher.java@@ -136,7 +136,7 @@ public class TagDispatcher {if (tagNode == null || tagNode.isNull()) {if (handler.strictTagValidation()) {throw SmithyValidationErrors.validationException(- "Value null at '" + key + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(key));}return tags;}@@ -190,7 +190,7 @@ public class TagDispatcher {if (handler.strictTagValidation() && !handler.allowEmptyTagKeys()&& (values == null || values.isEmpty())) {throw SmithyValidationErrors.validationException(- "Value null at '" + paramName + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(paramName));}return (values == null) ? List.of() : List.copyOf(values);}diff --git a/src/main/java/io/github/hectorvent/floci/services/acm/AcmJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/acm/AcmJsonHandler.javaindex 1582ce8b7f..2824e62f41 100644--- a/src/main/java/io/github/hectorvent/floci/services/acm/AcmJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/acm/AcmJsonHandler.java@@ -98,7 +98,7 @@ public class AcmJsonHandler {if (domainName == null || domainName.isBlank()) {return Response.status(400).entity(new AwsErrorResponse("ValidationException",- "Value null at 'domainName' failed to satisfy constraint: Member must not be null"))+ SmithyValidationErrors.notNull("domainName"))).build();}JsonNode sanNode = request.path("SubjectAlternativeNames");diff --git a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.javaindex 611cbe6de2..04e5be6e80 100644--- a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandler.java@@ -2002,8 +2002,7 @@ public class AutoScalingQueryHandler {}if (deviceName == null || deviceName.isBlank()) {throw SmithyValidationErrors.validationError(- "Value null at '" + prefix- + ".DeviceName' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(prefix + ".DeviceName"));}LaunchConfigurationBlockDeviceMapping mapping = new LaunchConfigurationBlockDeviceMapping();mapping.setDeviceName(deviceName);@@ -2080,8 +2079,7 @@ public class AutoScalingQueryHandler {String val = p.getFirst(key);if (val == null || val.isBlank()) {throw SmithyValidationErrors.validationError(- "Value null at '" + key- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(key));}if (!"true".equalsIgnoreCase(val) && !"false".equalsIgnoreCase(val)) {throw SmithyValidationErrors.validationError(diff --git a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.javaindex bed21b896b..413d2ffbfd 100644--- a/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java+++ b/src/main/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingService.java@@ -107,8 +107,7 @@ public class AutoScalingService implements PassedRoleLookup {"GroupAndWarmPoolDesiredCapacity", "GroupAndWarmPoolTotalCapacity");public static final String METRICS_GRANULARITY = "1Minute";static final String MISSING_GRANULARITY_MESSAGE =- "1 validation error detected: Value null at 'granularity' failed to satisfy constraint: "- + "Member must not be null";+ SmithyValidationErrors.message(List.of(SmithyValidationErrors.notNull("granularity")));public static final String INVALID_GRANULARITY_MESSAGE ="Granularity must be 1Minute. 1Minute is the only valid value.";static final String ACTIVE_INSTANCE_REFRESH_DESIRED_CONFIGURATION_MESSAGE =@@ -1200,8 +1199,7 @@ public class AutoScalingService implements PassedRoleLookup {private static void validateLifecycleHookName(String hookName) {if (hookName == null) {throw SmithyValidationErrors.validationError(- "Value null at 'lifecycleHookName' failed to satisfy constraint: "- + "Member must not be null");+ SmithyValidationErrors.notNull("lifecycleHookName"));}if (hookName.length() > 255) {throw SmithyValidationErrors.validationError(diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.javaindex 2150069811..f00d736cde 100644--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java@@ -1414,7 +1414,7 @@ public class CloudFormationService implements ResourceProvider {private static void validateContinueUpdateRollback(String stackNameOrArn, List<String> resourcesToSkip) {List<String> violations = new ArrayList<>();if (stackNameOrArn == null) {- violations.add("Value null at 'stackName' failed to satisfy constraint: Member must not be null");+ violations.add(SmithyValidationErrors.notNull("stackName"));} else {if (stackNameOrArn.isEmpty()) {violations.add("Value '' at 'stackName' failed to satisfy constraint:"diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontService.java b/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontService.javaindex e9db02dc64..961d806135 100644--- a/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontService.java+++ b/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontService.java@@ -1367,8 +1367,7 @@ public class CloudFrontService implements ServerCertificateReferenceProvider {}private static String nullViolation(String member) {- return "Value null at 'originAccessControlConfig." + member- + "' failed to satisfy constraint: Member must not be null";+ return SmithyValidationErrors.notNull("originAccessControlConfig." + member);}/** The kinds of Lambda origin CloudFront tells apart. */diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.javaindex 4b77614f65..16b148537a 100644--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java@@ -2032,7 +2032,7 @@ public class CognitoService implements ResourceProvider {private void validateLogConfigurations(List<Map<String, Object>> configs) {if (configs == null) {throw validationErrors(List.of(- "Value null at 'logConfigurations' failed to satisfy constraint: Member must not be null"));+ SmithyValidationErrors.notNull("logConfigurations")));}List<String> errors = new ArrayList<>();diff --git a/src/main/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityJsonHandler.javaindex 456750e0a0..acdadd97f2 100644--- a/src/main/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityJsonHandler.java@@ -220,9 +220,8 @@ public class CognitoIdentityJsonHandler {private boolean requiredBool(JsonNode node, String field) {Boolean value = bool(node, field);if (value == null) {- throw SmithyValidationErrors.validationException("Value null at '"- + Character.toLowerCase(field.charAt(0)) + field.substring(1)- + "' failed to satisfy constraint: Member must not be null");+ throw SmithyValidationErrors.validationException(+ SmithyValidationErrors.notNull(Character.toLowerCase(field.charAt(0)) + field.substring(1)));}return value;}diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.javaindex c5ac1dd371..2e3bd8aa76 100644--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java@@ -802,8 +802,7 @@ public class DynamoDbService {private static void requireVectorIndexMember(Object value, String memberPath) {if (value == null) {throw SmithyValidationErrors.validationException(- "Value null at '" + memberPath- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(memberPath));}}diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTableNames.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTableNames.javaindex cd05844e54..4c12d4bb5f 100644--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTableNames.java+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTableNames.java@@ -55,7 +55,7 @@ public final class DynamoDbTableNames {private static ResolvedTableRef resolveInternal(String input) {if (input == null) {throw SmithyValidationErrors.validationException(- "Value null at 'tableName' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("tableName"));}if (input.isEmpty()) {throw SmithyValidationErrors.validationException(diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.javaindex e36d512cf8..6fab0cf247 100644--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java@@ -317,9 +317,10 @@ public class NativeDynamoDbJsonHandler {// projection type check. A null NonKeyAttributes counts as not specified.private static String requireIndexName(JsonNode node, String memberPath) {JsonNode indexNameNode = node.path("IndexName");- String constraint = " at '" + memberPath + ".indexName' failed to satisfy constraint: ";+ String path = memberPath + ".indexName";+ String constraint = " at '" + path + "' failed to satisfy constraint: ";if (indexNameNode.isMissingNode() || indexNameNode.isNull()) {- throwValidationErrors(List.of("Value null" + constraint + "Member must not be null"));+ throwValidationErrors(List.of(SmithyValidationErrors.notNull(path)));}String indexName = indexNameNode.asText();String value = "Value '" + indexName + "'" + constraint;@@ -353,9 +354,7 @@ public class NativeDynamoDbJsonHandler {JsonNode vectorAttribute = node.path("VectorAttribute");if (vectorAttribute.isObject() && !vectorAttribute.hasNonNull("AttributeName")) {throw SmithyValidationErrors.validationException(- "Value null at '" + memberPath- + ".vectorAttribute.attributeName' failed to satisfy constraint: "- + "Member must not be null");+ SmithyValidationErrors.notNull(memberPath + ".vectorAttribute.attributeName"));}List<SearchSchemaElement> searchSchema = new ArrayList<>();JsonNode searchSchemaArray = node.path("SearchSchema");@@ -1887,8 +1886,7 @@ public class NativeDynamoDbJsonHandler {DynamoDbTableNames.resolveWithRegion(tableName, region);JsonNode spec = request.path("PointInTimeRecoverySpecification");if (spec.isMissingNode() || spec.isNull()) {- throwValidationErrors(List.of("Value null at 'pointInTimeRecoverySpecification' failed to satisfy "- + "constraint: Member must not be null"));+ throwValidationErrors(List.of(SmithyValidationErrors.notNull("pointInTimeRecoverySpecification")));}List<String> violations = new ArrayList<>();JsonNode period = spec.path("RecoveryPeriodInDays");@@ -1902,8 +1900,8 @@ public class NativeDynamoDbJsonHandler {}JsonNode enabled = spec.path("PointInTimeRecoveryEnabled");if (enabled.isMissingNode() || enabled.isNull()) {- violations.add("Value null at 'pointInTimeRecoverySpecification.pointInTimeRecoveryEnabled' failed to "- + "satisfy constraint: Member must not be null");+ violations.add(+ SmithyValidationErrors.notNull("pointInTimeRecoverySpecification.pointInTimeRecoveryEnabled"));}throwValidationErrors(violations);Integer recoveryPeriodInDays = period.isNumber() ? period.asInt() : null;@@ -1926,7 +1924,7 @@ public class NativeDynamoDbJsonHandler {JsonNode backupNameNode = request.path("BackupName");if (backupNameNode.isMissingNode() || backupNameNode.isNull()) {throwValidationErrors(List.of(- "Value null at 'backupName' failed to satisfy constraint: Member must not be null"));+ SmithyValidationErrors.notNull("backupName")));}String backupName = backupNameNode.asText();throwValidationErrors(nameViolations(backupName, "backupName"));@@ -2199,10 +2197,10 @@ public class NativeDynamoDbJsonHandler {}for (String member : List.of("WriteCapacityUnits", "ReadCapacityUnits")) {JsonNode value = throughput.path(member);- String constraint = " at '" + memberPath + "." + Character.toLowerCase(member.charAt(0))- + member.substring(1) + "' failed to satisfy constraint: ";+ String path = memberPath + "." + Character.toLowerCase(member.charAt(0)) + member.substring(1);+ String constraint = " at '" + path + "' failed to satisfy constraint: ";if (value.isMissingNode() || value.isNull()) {- violations.add("Value null" + constraint + "Member must not be null");+ violations.add(SmithyValidationErrors.notNull(path));} else if (value.asLong() < 1) {violations.add("Value '" + value.asText() + "'" + constraint+ "Member must have value greater than or equal to 1");@@ -2215,7 +2213,7 @@ public class NativeDynamoDbJsonHandler {private static List<String> restoreIndexNameViolations(JsonNode indexName, String memberPath) {String constraint = " at '" + memberPath + "' failed to satisfy constraint: ";if (indexName.isMissingNode() || indexName.isNull()) {- return List.of("Value null" + constraint + "Member must not be null");+ return List.of(SmithyValidationErrors.notNull(memberPath));}String value = "Value '" + indexName.asText() + "'" + constraint;List<String> violations = new ArrayList<>();@@ -2668,8 +2666,7 @@ public class NativeDynamoDbJsonHandler {}if (!request.hasNonNull("Policy")) {throw SmithyValidationErrors.validationException(- "Value null at 'policy' failed to satisfy constraint: "- + "Member must not be null");+ SmithyValidationErrors.notNull("policy"));}String policy = request.path("Policy").asText();String expectedRevisionId = request.has("ExpectedRevisionId")diff --git a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsJsonHandler.javaindex 43290a28fd..46fa1707e5 100644--- a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsJsonHandler.java@@ -1462,8 +1462,8 @@ public class EcsJsonHandler {}if (!node.hasNonNull("type")) {throw SmithyValidationErrors.exception("ClientException",- "Value null at 'containerDefinitions." + containerIndex- + ".member.firelensConfiguration.type' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("containerDefinitions." + containerIndex+ + ".member.firelensConfiguration.type"));}String type = node.path("type").asText();if (!"fluentd".equals(type) && !"fluentbit".equals(type)) {diff --git a/src/main/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessJobRunService.java b/src/main/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessJobRunService.javaindex 5d1407bfc3..d074d2f2ba 100644--- a/src/main/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessJobRunService.java+++ b/src/main/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessJobRunService.java@@ -444,10 +444,10 @@ public class EmrServerlessJobRunService {private static void validate(StartJobRunRequest request) {List<String> violations = new ArrayList<>();if (request.getClientToken() == null) {- violations.add(notNull("clientToken"));+ violations.add(SmithyValidationErrors.notNull("clientToken"));}if (request.getExecutionRoleArn() == null) {- violations.add(notNull("executionRoleArn"));+ violations.add(SmithyValidationErrors.notNull("executionRoleArn"));} else if (!ROLE_ARN.matcher(request.getExecutionRoleArn()).matches()) {violations.add("Value at 'executionRoleArn' failed to satisfy constraint: "+ "Member must satisfy regular expression pattern: " + ROLE_ARN_PATTERN);@@ -464,10 +464,10 @@ public class EmrServerlessJobRunService {}JobDriver driver = request.getJobDriver();if (driver != null && driver.getSparkSubmit() != null && driver.getSparkSubmit().getEntryPoint() == null) {- violations.add(notNull("jobDriver.sparkSubmit.entryPoint"));+ violations.add(SmithyValidationErrors.notNull("jobDriver.sparkSubmit.entryPoint"));}if (driver != null && driver.getHive() != null && driver.getHive().getQuery() == null) {- violations.add(notNull("jobDriver.hive.query"));+ violations.add(SmithyValidationErrors.notNull("jobDriver.hive.query"));}if (!violations.isEmpty()) {throw SmithyValidationErrors.validationException(violations);@@ -480,9 +480,6 @@ public class EmrServerlessJobRunService {}}- private static String notNull(String member) {- return "Value null at '" + member + "' failed to satisfy constraint: Member must not be null";- }/*** From Amazon EMR release 7.11.0 a BATCH run's timeout is 1 to 10080 minutes; an earlier release, ordiff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.javaindex 6fb77af085..db26874eb6 100644--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.java@@ -1452,7 +1452,7 @@ public class IamQueryHandler {String description = params.getFirst("Description");if (description == null) {throw SmithyValidationErrors.validationError(- "Value null at 'description' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("description"));}IamRole role = iamService.updateRoleDescription(getParam(params, "RoleName"), description);String result = new XmlBuilder().start("Role").raw(roleXml(role, true)).end("Role").build();@@ -3587,9 +3587,7 @@ public class IamQueryHandler {String value = params.getFirst(name);if (value == null || value.isBlank()) {throw SmithyValidationErrors.validationError(- "Value null at '"- + Character.toLowerCase(name.charAt(0)) + name.substring(1)- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(Character.toLowerCase(name.charAt(0)) + name.substring(1)));}return value;}diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.javaindex 0d8590651f..0fdec56b01 100644--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java@@ -2858,8 +2858,7 @@ public class IamService implements SessionAccountLookup, ResourceProvider {private static void validatePassword(String password, String member) {if (password == null) {throw SmithyValidationErrors.validationError(- "Value null at '" + member- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(member));}if (!LOGIN_PROFILE_PASSWORD_PATTERN.matcher(password).matches()) {throw SmithyValidationErrors.validationError(@@ -2932,8 +2931,7 @@ public class IamService implements SessionAccountLookup, ResourceProvider {public void putAccountProperties(Map<String, String> properties) {if (properties == null || properties.isEmpty()) {throw SmithyValidationErrors.validationError(- "Value null at 'properties' failed to "- + "satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("properties"));}String namespace = null;for (Map.Entry<String, String> entry : properties.entrySet()) {diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/StsQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/iam/StsQueryHandler.javaindex cce27bc01f..10f4459dec 100644--- a/src/main/java/io/github/hectorvent/floci/services/iam/StsQueryHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/iam/StsQueryHandler.java@@ -918,8 +918,7 @@ public class StsQueryHandler {String value = params.getFirst(name);if (value == null || value.isBlank()) {return AwsQueryResponse.error("ValidationError",- "1 validation error detected: Value null at '" + name- + "' failed to satisfy constraint: Member must not be null",+ SmithyValidationErrors.message(List.of(SmithyValidationErrors.notNull(name))),AwsNamespaces.STS, 400);}}diff --git a/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java b/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.javaindex 1e225d10f0..79bd1a1369 100644--- a/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java+++ b/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java@@ -188,7 +188,7 @@ public class IotFleetIndexingService {String nextToken = text(request.path("nextToken"), "nextToken");List<String> errors = new ArrayList<>();if (queryString == null) {- errors.add("Value null at 'queryString' failed to satisfy constraint: Member must not be null");+ errors.add(SmithyValidationErrors.notNull("queryString"));} else if (queryString.isEmpty()) {errors.add("Value '' at 'queryString' failed to satisfy constraint: "+ "Member must have length greater than or equal to 1");@@ -468,8 +468,7 @@ public class IotFleetIndexingService {String value = text(node.path(member), prefix + "." + member);if (value == null) {if (required) {- errors.add("Value null at '" + prefix + "." + member- + "' failed to satisfy constraint: Member must not be null");+ errors.add(SmithyValidationErrors.notNull(prefix + "." + member));}return "OFF";}diff --git a/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.javaindex 3f37038582..26bda9561b 100644--- a/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java@@ -829,8 +829,7 @@ public class KmsJsonHandler {String name = Character.toLowerCase(member.charAt(0)) + member.substring(1);JsonNode value = request.path(member);if (value.isMissingNode() || value.isNull()) {- throw SmithyValidationErrors.validationException("Value null at '" + name- + "' failed to satisfy constraint: Member must not be null");+ throw SmithyValidationErrors.validationException(SmithyValidationErrors.notNull(name));}String keyId = value.asText();String pattern = "Value '" + keyId + "' at '" + namediff --git a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.javaindex 18448b86bc..4b84389612 100644--- a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java+++ b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java@@ -2006,8 +2006,7 @@ public class KmsService implements ResourceProvider {private static void validateEnumMember(String member, String value, List<String> allowed) {if (value == null) {throw SmithyValidationErrors.validationException(- "Value null at '" + member + "' failed to satisfy "- + "constraint: Member must not be null");+ SmithyValidationErrors.notNull(member));}if (!allowed.contains(value)) {throw SmithyValidationErrors.validationException(diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerService.javaindex d14ccd3f84..58819e6d13 100644--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerService.java+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerService.java@@ -409,8 +409,7 @@ public class LambdaLayerService {public LambdaLayerVersion getLayerVersionByArn(String layerVersionArn) {if (layerVersionArn == null || layerVersionArn.isEmpty()) {throw SmithyValidationErrors.validationException(- "Value null at 'arn' failed to satisfy constraint: "- + "Member must not be null");+ SmithyValidationErrors.notNull("arn"));}if (layerVersionArn.length() > MAX_LAYER_VERSION_ARN_LENGTH|| !LAYER_VERSION_ARN.matcher(layerVersionArn).matches()) {diff --git a/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebValidation.java b/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebValidation.javaindex 57c8768e46..c00fd1c674 100644--- a/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebValidation.java+++ b/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebValidation.java@@ -18,7 +18,7 @@ final class LambdaWebValidation {/** A member read by {@link LambdaWebJson}, so an absent JSON member arrives as null. */LambdaWebValidation required(String path, Object value) {if (value == null) {- errors.add("Value null at '" + path + "' failed to satisfy constraint: Member must not be null");+ errors.add(SmithyValidationErrors.notNull(path));}return this;}diff --git a/src/main/java/io/github/hectorvent/floci/services/scheduler/SchedulerService.java b/src/main/java/io/github/hectorvent/floci/services/scheduler/SchedulerService.javaindex c77560163a..75674fb715 100644--- a/src/main/java/io/github/hectorvent/floci/services/scheduler/SchedulerService.java+++ b/src/main/java/io/github/hectorvent/floci/services/scheduler/SchedulerService.java@@ -351,7 +351,7 @@ public class SchedulerService {private void validateScheduleRequest(ScheduleRequest req) {if (req.getScheduleExpression() == null || req.getScheduleExpression().isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'scheduleExpression' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("scheduleExpression"));}if (req.getScheduleExpression().length() > 256) {throw SmithyValidationErrors.validationException(@@ -366,12 +366,12 @@ public class SchedulerService {}if (req.getFlexibleTimeWindow() == null) {throw SmithyValidationErrors.validationException(- "Value null at 'flexibleTimeWindow' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("flexibleTimeWindow"));}String flexibleTimeWindowMode = req.getFlexibleTimeWindow().getMode();if (flexibleTimeWindowMode == null || flexibleTimeWindowMode.isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'flexibleTimeWindow.mode' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("flexibleTimeWindow.mode"));}flexibleTimeWindowMode = flexibleTimeWindowMode.trim();if (!"OFF".equals(flexibleTimeWindowMode) && !"FLEXIBLE".equals(flexibleTimeWindowMode)) {@@ -381,7 +381,7 @@ public class SchedulerService {if ("FLEXIBLE".equals(flexibleTimeWindowMode)&& req.getFlexibleTimeWindow().getMaximumWindowInMinutes() == null) {throw SmithyValidationErrors.validationException(- "Value null at 'flexibleTimeWindow.maximumWindowInMinutes' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("flexibleTimeWindow.maximumWindowInMinutes"));}if ("OFF".equals(flexibleTimeWindowMode)&& req.getFlexibleTimeWindow().getMaximumWindowInMinutes() != null) {@@ -390,15 +390,15 @@ public class SchedulerService {}if (req.getTarget() == null) {throw SmithyValidationErrors.validationException(- "Value null at 'target' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("target"));}if (req.getTarget().getArn() == null || req.getTarget().getArn().isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'target.arn' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("target.arn"));}if (req.getTarget().getRoleArn() == null || req.getTarget().getRoleArn().isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'target.roleArn' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("target.roleArn"));}if (req.getTarget().getRoleArn().length() > 1600) {throw SmithyValidationErrors.validationException(@@ -415,7 +415,7 @@ public class SchedulerService {&& (req.getTarget().getDeadLetterConfig().getArn() == null|| req.getTarget().getDeadLetterConfig().getArn().isBlank())) {throw SmithyValidationErrors.validationException(- "Value null at 'target.deadLetterConfig.arn' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("target.deadLetterConfig.arn"));}String input = req.getTarget().getInput();if (input != null && requiresJsonInput(req.getTarget().getArn()) && !isWellFormedJson(input)) {diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.javaindex a6bdabeb55..d41183e832 100644--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java@@ -273,8 +273,7 @@ public class SesAccountController {if (node.isMissingNode() || node.isNull()) {if (required) {throw SmithyValidationErrors.badRequest(- "Value null at '" + path- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(path));}return false;}diff --git a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmJsonHandler.javaindex ec8e2ee173..4d9b696ffc 100644--- a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmJsonHandler.java+++ b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmJsonHandler.java@@ -526,8 +526,7 @@ public class SsmJsonHandler {String permissionType = request.path("PermissionType").asText();if (permissionType == null || permissionType.isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'permissionType' failed to satisfy "- + "constraint: Member must not be null");+ SmithyValidationErrors.notNull("permissionType"));}if (!"Share".equals(permissionType)) {throw new AwsException("InvalidPermissionType",@@ -651,8 +650,7 @@ public class SsmJsonHandler {JsonNode contentNode = request.path("Content");if (!contentNode.isTextual() || contentNode.asText().isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'content' failed to satisfy "- + "constraint: Member must not be null");+ SmithyValidationErrors.notNull("content"));}return contentNode.asText();}@@ -818,7 +816,7 @@ public class SsmJsonHandler {JsonNode nameNode = request.path("Name");if (!nameNode.isTextual() || nameNode.asText().isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'name' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("name"));}String name = nameNode.asText();@@ -851,7 +849,7 @@ public class SsmJsonHandler {String associationId = request.hasNonNull("AssociationId") ? request.path("AssociationId").asText() : null;if (associationId == null || associationId.isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'associationId' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull("associationId"));}String associationName = request.hasNonNull("AssociationName") ? request.path("AssociationName").asText() : null;@@ -1150,12 +1148,12 @@ public class SsmJsonHandler {List<String> violations = new ArrayList<>();if (name == null) {- violations.add("Value null at 'name' failed to satisfy constraint: Member must not be null");+ violations.add(SmithyValidationErrors.notNull("name"));} else if (name.isEmpty()) {violations.add("Value '' at 'name' failed to satisfy constraint: Member must have length greater than or equal to 1");}if (parameterVersion == null) {- violations.add("Value null at 'parameterVersion' failed to satisfy constraint: Member must not be null");+ violations.add(SmithyValidationErrors.notNull("parameterVersion"));}String labelViolation = SsmService.labelListViolation(labels);if (labelViolation != null) {@@ -1248,8 +1246,7 @@ public class SsmJsonHandler {String settingId = request.path("SettingId").asText();if (settingId == null || settingId.isBlank()) {throw SmithyValidationErrors.validationException(- "Value null at 'settingId' failed to satisfy "- + "constraint: Member must not be null");+ SmithyValidationErrors.notNull("settingId"));}return settingId;}@@ -1267,8 +1264,7 @@ public class SsmJsonHandler {String settingValue = valueNode.asText();if (!valueNode.isTextual() || settingValue.isEmpty()) {throw SmithyValidationErrors.validationException(- "Value null at 'settingValue' failed to satisfy "- + "constraint: Member must not be null");+ SmithyValidationErrors.notNull("settingValue"));}if (settingValue.length() > MAX_SETTING_VALUE_LENGTH) {throw SmithyValidationErrors.validationException(diff --git a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.javaindex 24ea4f09ab..d940ffceb1 100644--- a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java+++ b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java@@ -955,7 +955,7 @@ public class SsmService implements ResourceProvider {*/static String labelListViolation(List<String> labels) {if (labels == null) {- return "Value null at 'labels' failed to satisfy constraint: Member must not be null";+ return SmithyValidationErrors.notNull("labels");}String prefix = "Value '" + labels + "' at 'labels' failed to satisfy constraint: ";if (labels.isEmpty()) {diff --git a/src/main/java/io/github/hectorvent/floci/services/swf/SwfFaults.java b/src/main/java/io/github/hectorvent/floci/services/swf/SwfFaults.javaindex aed81868ab..ef61a49b39 100644--- a/src/main/java/io/github/hectorvent/floci/services/swf/SwfFaults.java+++ b/src/main/java/io/github/hectorvent/floci/services/swf/SwfFaults.java@@ -1,8 +1,11 @@package io.github.hectorvent.floci.services.swf;import io.github.hectorvent.floci.core.common.AwsException;+import io.github.hectorvent.floci.core.common.SmithyValidationErrors;import io.github.hectorvent.floci.services.swf.model.SwfConstants;+import java.util.List;+/*** Factory for SWF faults.*@@ -123,8 +126,7 @@ final class SwfFaults {}static AwsException missingRequired(String field) {- return validation("1 validation error detected: Value null at '" + field- + "' failed to satisfy constraint: Member must not be null");+ return validation(SmithyValidationErrors.message(List.of(SmithyValidationErrors.notNull(field))));}static AwsException fault(String code, String message) {diff --git a/src/main/java/io/github/hectorvent/floci/services/transcribe/TranscribeService.java b/src/main/java/io/github/hectorvent/floci/services/transcribe/TranscribeService.javaindex 5a70e68b84..60855178f6 100644--- a/src/main/java/io/github/hectorvent/floci/services/transcribe/TranscribeService.java+++ b/src/main/java/io/github/hectorvent/floci/services/transcribe/TranscribeService.java@@ -257,8 +257,7 @@ public class TranscribeService implements Resettable {private void requireNonBlank(String value, String fieldName) {if (value == null || value.isBlank()) {throw SmithyValidationErrors.badRequest(- "Value null at '" + fieldName- + "' failed to satisfy constraint: Member must not be null");+ SmithyValidationErrors.notNull(fieldName));}}