aws / aws/aws-cdk

(ecs): array of objects is incorrectly translated to keyword args in Python example

Open
#22,028 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs bug docs/generated documentation p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the issue

In the TypeScript API Ref, the [example](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Ec2Service.html#registerwbrloadwbrbalancerwbrtargetstargets) for `Ec2Service.registerLoadBalancerTargets` looks like this:

```js
declare const listener: elbv2.ApplicationListener;
declare const service: ecs.BaseService;
service.registerLoadBalancerTargets(
{
containerName: 'web',
containerPort: 80,
newTargetGroupId: 'ECS',
listener: ecs.ListenerConfig.applicationListener(listener, {
protocol: elbv2.ApplicationProtocol.HTTPS
}),
},
)
```

The [Python version of the example](https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ecs/Ec2Service.html#aws_cdk.aws_ecs.Ec2Service.register_load_balancer_targets) looks like this:

```python
# listener: elbv2.ApplicationListener
# service: ecs.BaseService

service.register_load_balancer_targets(
container_name="web",
container_port=80,
new_target_group_id="ECS",
listener=ecs.ListenerConfig.application_listener(listener,
protocol=elbv2.ApplicationProtocol.HTTPS
)
)
```

Each argument of the Python example should be an [EcsTarget](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-ecs.Ec2Service.html#registerwbrloadwbrbalancerwbrtargetstargets) with the properties given as keyword arguments. The keyword args are instead given as keyword arguments to `register_load_balancer_targets`, which is wrong.

### Links

https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_ecs/Ec2Service.html#aws_cdk.aws_ecs.Ec2Service.register_load_balancer_targets

Contributor guide

Open the contributing guide

Research direction

Start with the linked TypeScript and Python API reference entries for Ec2Service.registerLoadBalancerTargets and compare how the TypeScript example is rendered in Python. Trace the example-generation source or entry point responsible for this conversion. Done means each Python example argument is represented as an EcsTarget with keyword arguments, rather than passing those properties directly to register_load_balancer_targets.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 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.