Amazon.CDK.AWS.Lex: Property that used to be untyped and is now typed is easy to misuse
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
It seems that there is a PascalCase / camelCase issue when deploying a new Lex Bot using the CfnBot class. There is a mandatory property called "DataPrivacy". This property must be of type "CfnBot.DataPrivacyProperty", which also contains a mandatory property called "ChildDirected". Even this property has been set to "true", when deploying the stack it throws an error like this:
UPDATE_ROLLBACK_COMPLETE: Properties validation failed for resource MyResourceA629FA55 with message:
[#/DataPrivacy: extraneous key [childDirected] is not permitted]
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
It should deploy the Lex bot without any issues.
### Current Behavior
The deployment of the Lex bot is failing, so the entire changeset gets rolled back.
### Reproduction Steps
Define a CfnBot like this:
var bot = new CfnBot(this, $"{id}-{botName}", new CfnBotProps
{
Name = $"{botName}",
RoleArn = lexRole.RoleArn,
DataPrivacy = new CfnBot.DataPrivacyProperty
{
ChildDirected = false
},
IdleSessionTtlInSeconds = 300, // 5 minutes
Description = $"Bot for the {id} application.",
BotFileS3Location = new CfnBot.S3LocationProperty
{
S3Bucket = importBucket.BucketName,
S3ObjectKey = botKey,
}
});
### Possible Solution
Fix the JsiiProperty attribute of the property ChildDirected of the class Amazon.CDK.AWS.Lex.CfnBot.DataPrivacyProperty by changing its name from "childDirected" to "ChildDirected".
### Additional Information/Context
_No response_
### CDK CLI Version
2.1003.0 (build b242c23)
### Framework Version
.net 8
### Node.js Version
v20.9.0
### OS
Windows 11 23H2
### Language
.NET
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start at Amazon.CDK.AWS.Lex.CfnBot.DataPrivacyProperty and inspect the JsiiProperty metadata for ChildDirected, comparing the generated .NET property name with the CloudFormation key in the deployment error. Locate the relevant CDK or jsii test fixture, then run the supplied CfnBot reproduction and verify deployment no longer reports childDirected as an extraneous key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100