Serverless-application-model: Stack Failure in 'Method response status' with inline swagger definition

Created on 18 Feb 2017  路  8Comments  路  Source: aws/serverless-application-model

Using the inline swagger definition,
it failed with below message when the swagger definition has 'Method response status' like 200.

An error occurred (ValidationError) when calling the CreateChangeSet operation: Template format error: [/Resources/ApiGatewayApi/Properties/DefinitionBody/paths//XXXX/delete/responses] map keys must be strings; received numeric [200] instead

Most helpful comment

I've just run into the similar issue:
Template validation error: Template format error: [/Resources/xxx/get/responses] map keys must be strings; received numeric [200] instead

The swagger template has been generated with the API Gateway export tool in YAML format. Wrapping the 200 response code with double quotes in the generated swagger description has solved the issue.

All 8 comments

Can you share the SAM template you are using?

I added '.docx' because github doesn't allow the files with yaml extension, so please remove '.docx' after downloading.

template.yaml.docx

I was specifying responses as a numeric type and when I got this issue. Trying wrapping the response code in quotations.

              responses:
                '200':
                  description: 200 response

I thought I tried that before, but I didn't seem to have.
It works good, but it still fails with another error. (FYI, I added 'Empty' definition in the API 'DefinitionBody', which was another error).

Errors found during import: Unable to put integration on 'GET' for resource at path '/cloudtrail': AWS ARN for integration must contain path or action Unable to put integration on 'POST' for resource at path '/cloudtrail': AWS ARN for integration must contain path or action Unable to put integration on 'DELETE' for resource at path '/cloudtrail': AWS ARN for integration must contain path or action

Can you explain what this error mean?

Could this be related to #91?

This definitely looks like #91. I will close this one and use the other issue to track the bug

This is not the same issue as #91. In the documentation and the examples responses are shown not wrapped in quotes. I got this error as well and was able to resolve it by adding the quotes. Issue #91 refers to quotes being stripped away.

I've just run into the similar issue:
Template validation error: Template format error: [/Resources/xxx/get/responses] map keys must be strings; received numeric [200] instead

The swagger template has been generated with the API Gateway export tool in YAML format. Wrapping the 200 response code with double quotes in the generated swagger description has solved the issue.

Was this page helpful?
0 / 5 - 0 ratings