aws / aws/aws-cdk

(apigateway): Can we please convert httpMethod of class ResourceBase to an Enum ?

Open
#19,931 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-apigateway breaking-change effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the feature

Can we please convert `httpMethod` of class ResourceBase to an Enum ?
because it has only limited possible values in the AWS UI

```
const apigw = new LambdaRestApi(this, 'productApi', {
restApiName: 'Product Service',
handler: productFunction,
proxy: false,
})

const product = apigw.root.addResource('product');
product.addMethod('GET'); // product.addMethod(HttpMethods.GET) instead
```

### Use Case

This will help reduce error in typescript.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [X] I may be able to implement this feature request
- [X] This feature might incur a breaking change

### CDK version used

"aws-cdk": "2.20.0"

### Environment details (OS name and version, etc.)

Windows 10

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `ResourceBase` `httpMethod` value through the API Gateway entry point used by `product.addMethod('GET')`, and compare it with the proposed `HttpMethods.GET` usage. Check how existing TypeScript types expose allowed HTTP methods and identify the related API Gateway tests. Done means the supported methods are represented consistently without losing the current API behavior, with any breaking-change implications addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.