python-openapi / openapi-core

Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.
BSD 3-Clause "New" or "Revised" License
299 stars 133 forks source link

Add AWS Api Gateway integration #204

Open jgroom33 opened 4 years ago

jgroom33 commented 4 years ago

Add an integration similar to django/flask

+---------+    event   +---------+
| API_GW  +----------->+  lambda |
+---------+            +---------+

The event object is structured as here: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html

Example implementation:

def handler(event, context):

  from openapi_core.validation.request.validators import RequestValidator
  from openapi_core.contrib.aws import ApiGatewayEventOpenAPIRequest

  openapi_request = ApiGatewayEventOpenAPIRequest(event)
  validator = RequestValidator(spec)
  result = validator.validate(openapi_request)
jjmmolina commented 2 years ago

Hi @jgroom33 , is this, finally, implemented?

paulcruse3 commented 1 year ago

Yes, I too would like to know if this is completed and if show how to implement. Because I don't see it in the docs or in the code base

p1c2u commented 1 year ago

I don't use apig+lambda much but I can try to implement this if it's a need for this.

paulcruse3 commented 1 year ago

@p1c2u that would be awesome! 🙏🏽

alex-cook-finres commented 7 months ago

This would be a great addition, but are there any clean workarounds for doing this right now?