aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

stepfunction's CallApiGatewayHttpApiEndpointOptions should NOT tightly coupled with target api stack?

Open garyy7811 opened this issue 1 year ago • 1 comments

Describe the bug

` /**

  • Base properties for calling an HTTP API Endpoint / export interface CallApiGatewayHttpApiEndpointOptions { /*
    • The Id of the API to call */ readonly apiId: string;

/**

  • The Stack in which the API is defined */ readonly apiStack: cdk.Stack;

/**

  • Name of the stage where the API is deployed to in API Gateway
  • @default '$default' */ readonly stageName?: string; }`

readonly apiStack: cdk.Stack; I'm confused why we need to pass a code reference to the stack where the api is defined,

Regression Issue

  • [ ] Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

program design, code review should be conducted or add more comments to make sure user understand

Current Behavior

api caller is tightly coupled to callee on code ref level

Reproduction Steps

just take a look

Possible Solution

program design, code review should be conducted or add more comments to make sure user understand

Additional Information/Context

No response

CDK CLI Version

2.178.2

Framework Version

No response

Node.js Version

node20

OS

ubuntu

Language

TypeScript

Language Version

No response

Other information

this is one of the core modules, please do QA on each level

garyy7811 avatar Feb 19 '25 16:02 garyy7811

I think the reason is to construct this:

https://github.com/aws/aws-cdk/blob/ae544a15f8f65eb1b192acc16277ca3c40386a73/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts#L86-L89

but I think actually we could get the stack using

Stack.of(this) if CallApiGatewayHttpApiEndpoint is in the same scope with the api.

Requesting the team for further inputs.

pahud avatar Feb 19 '25 19:02 pahud