(apigateway): Imported RestAPIs do not have access to its methods due to casting #26247
Labels
@aws-cdk/aws-apigateway
Related to Amazon API Gateway
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
Imported RestAPIs are returned by CDK as
IRestAPI
. However in the source code, the imports extendRestAPIBase
which features additional helpful methods, such as themetric
methods. TheIRestAPI
interface does not come with methods such as themetric
methods, which prevents methods from being called without casting the imported RestAPI as aRestAPIBase
.Expected Behavior
I expect to be able to use methods that are okay to use on an imported RestAPI.
Current Behavior
I cannot use some methods that I should be able to
Reproduction Steps
You can successfully call the method using the following code. Note that removing the typecasting causes this to fail
Possible Solution
Probably put these methods on
IRestAPI
interface, but I didn't dive too deep into this so that could have other side effects.Additional Information/Context
No response
CDK CLI Version
latest
Framework Version
No response
Node.js Version
16
OS
mac
Language
Typescript
Language Version
No response
Other information
Sourced from this discussion
The text was updated successfully, but these errors were encountered: