I want to import a YAML file into API GateWay. Whenever I do so I get the following error
Resource handler returned message: "No integration defined for method (Service: ApiGateway, Status Code: 400
I use the following code to import the YAML file
const integration = new LambdaIntegration(hello)
const api = new SpecRestApi(this, 'books-api', {
apiDefinition: ApiDefinition.fromAsset('apiTrial.yaml')
});
const booksResource = api.root.addResource('books')
booksResource.addMethod('GET', integration);
});
and my current yaml file is:
openapi: 3.0.0
info:
title: "MyFirstAPI"
version: "1.0.0"
contact:
name: Karim Fayed
email: [email protected]
url: https://example.com/
tags:
- name: Metadata
description: Metadata related requests
servers:
- url: "https://api.openweathermap.org/data/2.5"
paths:
/:
get:
operationId: getMetadata
summary: Get metadata from the root of the API
tags: [ 'Metadata for root' ]
responses:
'200':
description: OK
/weather:
get:
operationId: "getMetadata"
summary: "Get metadata from weather API"
tags: ["metadata data for wather"]
responses:
200:
description: successful operation
400:
description: Invalid id supplied
404:
description: Contact not found
500:
description: Server error
As you can see I already have a response for code 400 so why would the error keep showing up?