- 
                Notifications
    You must be signed in to change notification settings 
- Fork 257
Closed
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
🐛 Bug Report
Affected Languages
-  TypeScriptorJavascript
-  Python
-  Java
-  .NET (C#,F#, ...)
-  Go
Example doesn't correctly initialize struct (requires research)
On:
https://docs.aws.amazon.com/cdk/api/latest/java/index.html
 // Example automatically generated. See https://github.com/aws/jsii/issues/826
 Object vpc = Vpc.Builder.create(this, "TheVPC")
         .natGateways(1)
         .subnetConfiguration(asList(Map.of(
                 "cidrMask", 26,
                 "name", "Public",
                 "subnetType", ec2.SubnetType.getPUBLIC()), Map.of(
                 "cidrMask", 26,
                 "name", "Application1",
                 "subnetType", ec2.SubnetType.getPRIVATE_WITH_NAT()), Map.of(
                 "cidrMask", 26,
                 "name", "Application2",
                 "subnetType", ec2.SubnetType.getPRIVATE_WITH_NAT(),
                 "reserved", true), Map.of(
                 "cidrMask", 27,
                 "name", "Database",
                 "subnetType", ec2.SubnetType.getISOLATED())))
         .build();That should be detecting a list of SubnetConfiguration structs, but is detecting a list of JSON objects.
(Caused by the example not typechecking properly? Although the comment indicates it has been compiled...)
Example doesn't correctly detect constants (requires research)
In the same example on https://docs.aws.amazon.com/cdk/api/latest/java/index.html
                 "subnetType", ec2.SubnetType.getPRIVATE_WITH_NAT()), Map.of(Should look like ec2.SubnetType.PRIVATE_WITH_NAT.
Structs don't use builders (easy fix)
On the same page https://docs.aws.amazon.com/cdk/api/latest/java/index.html
  NatInstanceProvider natGatewayProvider = ec2.NatProvider.instance(new NatInstanceProps()
         .instanceType(new InstanceType("t3.small")));new NatInstanceProps() is not the way to instantiate a struct. It should use new NatInstanceProps.Builder().instanceType(...).build()).
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.