aws-beam/aws-elixir

AWS.ApiGatewayV2.import_api and reimport_api may not work as expected

dergraf opened this issue · 1 comments

Hello

I think I've found an issue with the way the APIGatewayV2 import/reimport code has been generated (tested with the current hex release 0.8.0):

I expect that AWS.ApiGatewayV2.reimport_api(client, rest_api_id, Jason.encode!(openapi_spec)) would import the openapi spec.
However, AWS returns an HTTP 415 (unsupported media type). I think the issue is related to the enforced use of send_body_as_binary?

I am able to successfully call the API if I disable the send_body_as_binary? as well as changing the expected return code to 200. However, in this case one has to provide a somehow unnatural input, see below:

AWS.ApiGatewayV2.reimport_api(client, rest_api_id, %{"body" => Jason.encode!(openapi_spec)})

Note: In this case body doesn't start with a capital B . (see https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid.html#apis-apiid-schemas)

Interestingly importing an OpenAPI Spec works using the V1 API, where the generated code doesn't use the send_body_as_binary?

Please let me know if I can assist you in any way.

Best,
Andre

Interesting! I will check there more in deep soon. Thanks, @dergraf!