diff --git a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddCorsPreflightIntegration.java b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddCorsPreflightIntegration.java index 72662bca34c..ad2eab0f11b 100644 --- a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddCorsPreflightIntegration.java +++ b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddCorsPreflightIntegration.java @@ -238,7 +238,7 @@ private static ObjectNode createPreflightIntegration(Map hea } } - // Ensure that the mock integration include the "type" = "mock" property. - return integration.build().toNode().expectObjectNode().withMember("type", "mock"); + // Use createIntegration to fix the casing of the passThroughBehavior property. + return AddIntegrations.createIntegration(integration.build()); } } diff --git a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddIntegrations.java b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddIntegrations.java index 5ca412912cb..e765f893eda 100644 --- a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddIntegrations.java +++ b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddIntegrations.java @@ -65,7 +65,13 @@ public OperationObject updateOperation( }); } - private ObjectNode createIntegration( + static ObjectNode createIntegration(MockIntegrationTrait integration) { + // The MockIntegrationTrait path doesn't use the context or shape, + // so it's safe to pass null here for those. + return createIntegration(null, null, integration); + } + + private static ObjectNode createIntegration( Context context, OperationShape shape, Trait integration diff --git a/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-model.openapi.json b/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-model.openapi.json index 79422c2d9e6..e015324842f 100644 --- a/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-model.openapi.json +++ b/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-model.openapi.json @@ -84,7 +84,7 @@ "CORS" ], "x-amazon-apigateway-integration": { - "passThroughBehavior": "when_no_match", + "passthroughBehavior": "when_no_match", "contentHandling": "CONVERT_TO_TEXT", "requestTemplates": { "application/json": "{\"statusCode\":200}" @@ -254,7 +254,7 @@ "CORS" ], "x-amazon-apigateway-integration": { - "passThroughBehavior": "when_no_match", + "passthroughBehavior": "when_no_match", "contentHandling": "CONVERT_TO_TEXT", "requestTemplates": { "application/json": "{\"statusCode\":200}", diff --git a/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-with-additional-headers.openapi.json b/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-with-additional-headers.openapi.json index 5934c6992a8..7470b4afb9b 100644 --- a/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-with-additional-headers.openapi.json +++ b/smithy-aws-apigateway-openapi/src/test/resources/software/amazon/smithy/aws/apigateway/openapi/cors-with-additional-headers.openapi.json @@ -84,7 +84,7 @@ "CORS" ], "x-amazon-apigateway-integration": { - "passThroughBehavior": "when_no_match", + "passthroughBehavior": "when_no_match", "contentHandling": "CONVERT_TO_TEXT", "requestTemplates": { "application/json": "{\"statusCode\":200}" @@ -254,7 +254,7 @@ "CORS" ], "x-amazon-apigateway-integration": { - "passThroughBehavior": "when_no_match", + "passthroughBehavior": "when_no_match", "contentHandling": "CONVERT_TO_TEXT", "requestTemplates": { "application/json": "{\"statusCode\":200}",