Swagger file with AWS Extensions stored in S3 Bucket for API Creation with Cloudformation












0














I'm trying to create an API Gateway using a Cloudformation template like this:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
BodyS3Location:
Bucket:
Fn::ImportValue: !Sub ${EnvironmentName}-SwaggerApiBucket-Name
Key: swaggertest.yaml
ETag: !Ref ETag
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize


the Swagger-yaml file on the S3 Bucket looks like this:



  swagger: '2.0'
info:
version: '2016-08-17T18:08:34Z'
title: InvoicegenAPI
basePath: "/LATEST"
schemes:
- https
paths:
/greeting:
get:
summary: Get Greeting
parameters:
- name: name
in: query
required: false
type: string
produces:
- application/json
responses:
'200':
description: 200 response
x-amazon-apigateway-integration:
requestTemplates:
application/json: '{"name": "$input.params(''name'')"}'
uri:
Fn::Join:
- ''
- - 'arn:aws:apigateway:'
- Ref: AWS::Region
- ":lambda:path/2015-03-31/functions/"
- Fn::GetAtt:
- InvoiceLambda
- Arn
- "/invocations"
responses:
default:
statusCode: '200'
httpMethod: POST
type: aws


unfortunately it throws an error like this:



Unable to parse API definition because of a malformed integration at path /greeting. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 2cf08a97-e66f-11e8-afee-fb6b03568b64)


I double checked the Swagger file, all the indents seem fine. What am I missing?



There is a thread dealing with this issue already but has not yielded any solution yet.



Passing ARN reference from CloudFormation to Swagger



merci in advance



A










share|improve this question
























  • The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
    – Helen
    Nov 12 at 11:44












  • No, that was not the issue, it has something to do with the AWS integration.
    – aerioeus
    Nov 15 at 14:45
















0














I'm trying to create an API Gateway using a Cloudformation template like this:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
BodyS3Location:
Bucket:
Fn::ImportValue: !Sub ${EnvironmentName}-SwaggerApiBucket-Name
Key: swaggertest.yaml
ETag: !Ref ETag
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize


the Swagger-yaml file on the S3 Bucket looks like this:



  swagger: '2.0'
info:
version: '2016-08-17T18:08:34Z'
title: InvoicegenAPI
basePath: "/LATEST"
schemes:
- https
paths:
/greeting:
get:
summary: Get Greeting
parameters:
- name: name
in: query
required: false
type: string
produces:
- application/json
responses:
'200':
description: 200 response
x-amazon-apigateway-integration:
requestTemplates:
application/json: '{"name": "$input.params(''name'')"}'
uri:
Fn::Join:
- ''
- - 'arn:aws:apigateway:'
- Ref: AWS::Region
- ":lambda:path/2015-03-31/functions/"
- Fn::GetAtt:
- InvoiceLambda
- Arn
- "/invocations"
responses:
default:
statusCode: '200'
httpMethod: POST
type: aws


unfortunately it throws an error like this:



Unable to parse API definition because of a malformed integration at path /greeting. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 2cf08a97-e66f-11e8-afee-fb6b03568b64)


I double checked the Swagger file, all the indents seem fine. What am I missing?



There is a thread dealing with this issue already but has not yielded any solution yet.



Passing ARN reference from CloudFormation to Swagger



merci in advance



A










share|improve this question
























  • The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
    – Helen
    Nov 12 at 11:44












  • No, that was not the issue, it has something to do with the AWS integration.
    – aerioeus
    Nov 15 at 14:45














0












0








0







I'm trying to create an API Gateway using a Cloudformation template like this:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
BodyS3Location:
Bucket:
Fn::ImportValue: !Sub ${EnvironmentName}-SwaggerApiBucket-Name
Key: swaggertest.yaml
ETag: !Ref ETag
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize


the Swagger-yaml file on the S3 Bucket looks like this:



  swagger: '2.0'
info:
version: '2016-08-17T18:08:34Z'
title: InvoicegenAPI
basePath: "/LATEST"
schemes:
- https
paths:
/greeting:
get:
summary: Get Greeting
parameters:
- name: name
in: query
required: false
type: string
produces:
- application/json
responses:
'200':
description: 200 response
x-amazon-apigateway-integration:
requestTemplates:
application/json: '{"name": "$input.params(''name'')"}'
uri:
Fn::Join:
- ''
- - 'arn:aws:apigateway:'
- Ref: AWS::Region
- ":lambda:path/2015-03-31/functions/"
- Fn::GetAtt:
- InvoiceLambda
- Arn
- "/invocations"
responses:
default:
statusCode: '200'
httpMethod: POST
type: aws


unfortunately it throws an error like this:



Unable to parse API definition because of a malformed integration at path /greeting. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 2cf08a97-e66f-11e8-afee-fb6b03568b64)


I double checked the Swagger file, all the indents seem fine. What am I missing?



There is a thread dealing with this issue already but has not yielded any solution yet.



Passing ARN reference from CloudFormation to Swagger



merci in advance



A










share|improve this question















I'm trying to create an API Gateway using a Cloudformation template like this:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
BodyS3Location:
Bucket:
Fn::ImportValue: !Sub ${EnvironmentName}-SwaggerApiBucket-Name
Key: swaggertest.yaml
ETag: !Ref ETag
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize


the Swagger-yaml file on the S3 Bucket looks like this:



  swagger: '2.0'
info:
version: '2016-08-17T18:08:34Z'
title: InvoicegenAPI
basePath: "/LATEST"
schemes:
- https
paths:
/greeting:
get:
summary: Get Greeting
parameters:
- name: name
in: query
required: false
type: string
produces:
- application/json
responses:
'200':
description: 200 response
x-amazon-apigateway-integration:
requestTemplates:
application/json: '{"name": "$input.params(''name'')"}'
uri:
Fn::Join:
- ''
- - 'arn:aws:apigateway:'
- Ref: AWS::Region
- ":lambda:path/2015-03-31/functions/"
- Fn::GetAtt:
- InvoiceLambda
- Arn
- "/invocations"
responses:
default:
statusCode: '200'
httpMethod: POST
type: aws


unfortunately it throws an error like this:



Unable to parse API definition because of a malformed integration at path /greeting. (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 2cf08a97-e66f-11e8-afee-fb6b03568b64)


I double checked the Swagger file, all the indents seem fine. What am I missing?



There is a thread dealing with this issue already but has not yielded any solution yet.



Passing ARN reference from CloudFormation to Swagger



merci in advance



A







swagger amazon-cloudformation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 at 14:47

























asked Nov 12 at 11:37









aerioeus

86112




86112












  • The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
    – Helen
    Nov 12 at 11:44












  • No, that was not the issue, it has something to do with the AWS integration.
    – aerioeus
    Nov 15 at 14:45


















  • The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
    – Helen
    Nov 12 at 11:44












  • No, that was not the issue, it has something to do with the AWS integration.
    – aerioeus
    Nov 15 at 14:45
















The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
– Helen
Nov 12 at 11:44






The indents for summary, parameters, Fn::Join and type: aws are off. Paste your YAML into editor.swagger.io to see the errors.
– Helen
Nov 12 at 11:44














No, that was not the issue, it has something to do with the AWS integration.
– aerioeus
Nov 15 at 14:45




No, that was not the issue, it has something to do with the AWS integration.
– aerioeus
Nov 15 at 14:45












1 Answer
1






active

oldest

votes


















0





+50









I think you problem is on using the BodyS3Location property for the referenced S3 file, which is probably not parsing the YAML file, therefore not resolving your instricic functions.



My suggestion is that you change to Body + AWS::Include Transform, similar to what was suggested on Passing ARN reference from CloudFormation to Swagger. Try this as your Resource:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: !Sub 's3://${EnvironmentName}-SwaggerApiBucket-Name/swaggertest.yaml'
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize





share|improve this answer





















  • Merci @tyron, that worked!
    – aerioeus
    Nov 19 at 18:26











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261354%2fswagger-file-with-aws-extensions-stored-in-s3-bucket-for-api-creation-with-cloud%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0





+50









I think you problem is on using the BodyS3Location property for the referenced S3 file, which is probably not parsing the YAML file, therefore not resolving your instricic functions.



My suggestion is that you change to Body + AWS::Include Transform, similar to what was suggested on Passing ARN reference from CloudFormation to Swagger. Try this as your Resource:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: !Sub 's3://${EnvironmentName}-SwaggerApiBucket-Name/swaggertest.yaml'
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize





share|improve this answer





















  • Merci @tyron, that worked!
    – aerioeus
    Nov 19 at 18:26
















0





+50









I think you problem is on using the BodyS3Location property for the referenced S3 file, which is probably not parsing the YAML file, therefore not resolving your instricic functions.



My suggestion is that you change to Body + AWS::Include Transform, similar to what was suggested on Passing ARN reference from CloudFormation to Swagger. Try this as your Resource:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: !Sub 's3://${EnvironmentName}-SwaggerApiBucket-Name/swaggertest.yaml'
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize





share|improve this answer





















  • Merci @tyron, that worked!
    – aerioeus
    Nov 19 at 18:26














0





+50







0





+50



0




+50




I think you problem is on using the BodyS3Location property for the referenced S3 file, which is probably not parsing the YAML file, therefore not resolving your instricic functions.



My suggestion is that you change to Body + AWS::Include Transform, similar to what was suggested on Passing ARN reference from CloudFormation to Swagger. Try this as your Resource:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: !Sub 's3://${EnvironmentName}-SwaggerApiBucket-Name/swaggertest.yaml'
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize





share|improve this answer












I think you problem is on using the BodyS3Location property for the referenced S3 file, which is probably not parsing the YAML file, therefore not resolving your instricic functions.



My suggestion is that you change to Body + AWS::Include Transform, similar to what was suggested on Passing ARN reference from CloudFormation to Swagger. Try this as your Resource:



Resources:
InvoiceApi:
Type: AWS::ApiGateway::RestApi
Properties:
Description: an Api for our Invoicegen App
Name: !Ref ApiName
ApiKeySourceType: !Ref ApiKeySourceType
BinaryMediaTypes:
- !Ref binaryMediaType1
- !Ref binaryMediaType2
Body:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: !Sub 's3://${EnvironmentName}-SwaggerApiBucket-Name/swaggertest.yaml'
EndpointConfiguration:
Types:
- REGIONAL
FailOnWarnings: true
MinimumCompressionSize: !Ref minimumCompressionSize






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 18 at 13:18









tyron

1,006925




1,006925












  • Merci @tyron, that worked!
    – aerioeus
    Nov 19 at 18:26


















  • Merci @tyron, that worked!
    – aerioeus
    Nov 19 at 18:26
















Merci @tyron, that worked!
– aerioeus
Nov 19 at 18:26




Merci @tyron, that worked!
– aerioeus
Nov 19 at 18:26


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261354%2fswagger-file-with-aws-extensions-stored-in-s3-bucket-for-api-creation-with-cloud%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine