Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell committed Jan 12, 2021
1 parent 1084971 commit 9c1f284
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ private static void validateTraitConfiguration(IntegrationTrait trait,
ApiGatewayConfig.ApiType apiType = context.getConfig().getExtensions(ApiGatewayConfig.class)
.getApiGatewayType();
if (!trait.getPayloadFormatVersion().isPresent() && apiType.equals(ApiGatewayConfig.ApiType.HTTP)) {
throw new OpenApiException("When using the HTTP apiGatewayType, a payloadFormatVersion must be set on the"
+ " integration applied to the operation: " + operation.getId());
throw new OpenApiException("When the 'apiGatewayType' OpenAPI conversion setting is 'HTTP', a "
+ "'payloadFormatVersion' must be set on the aws.apigateway#integration trait.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void throwsOnInvalidIntegrationTraitForHttpApi() {
OpenApiConverter.create().config(config).convertToNode(model);
});

assertThat(thrown.getMessage(), containsString("a payloadFormatVersion must be set on the integration"
+ " applied to the operation:"));
assertThat(thrown.getMessage(), containsString("When the 'apiGatewayType' OpenAPI conversion setting is"
+ " 'HTTP', a 'payloadFormatVersion' must be set on the aws.apigateway#integration trait."));
}
}

0 comments on commit 9c1f284

Please sign in to comment.