swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Integration with AWS Lambda

Open vladaman opened this issue 3 years ago • 0 comments

Is there any way to integrate swagger-core with our AWS Lambda code? We expose methods via AWS API Gateway proxy+ style integration since we don't want to build separate docs on API Gateway. This seems like an extra step to us. It would be nice if we can serve our microservices directly and also generate OpenAPI spec file from the code. Is there any way?

public class Handler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
    @Override
    public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent input, Context context) {
        
        // Handle request here 
        String path = input.getPath();

        return new APIGatewayProxyResponseEvent()
                .withStatusCode(200)
                .withHeaders(Collections.emptyMap())
                .withBody(someStringOutput);
    }
}

vladaman avatar Jun 22 '22 10:06 vladaman