-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the bug
It looks like the aws-apigateway JsonSchema interface is wrong with its type for the additionalItems property: The interface expects type JsonSchema[] but, based on the JSON Schema Draft-04 meta schema, it should be JsonSchema | boolean, just like it is for additionalProperties. This error results in models that include an additionalItems parameter being undeployable via CDK:
- If the CDK code follows the JSON interface and provides a
JsonSchema[], API Gateway will reject the model as invalid. - If the CDK code correctly uses a
JsonSchemaorboolean, the app won't synthesize.
I'll demonstrate the correct use of additionalItems in the integration test for the PR I'll open to fix this, shortly.
Expected Behavior
aws-cdk should deploy any correct JSON Schema model up to Draft-04.
Current Behavior
aws-cdk cannot deploy models with JsonSchema that include additionalItems.
Reproduction Steps
See the integration test in accompanying PR.
Possible Solution
We should be able to simply correct the interface. This is strictly a breaking change but, based on my understanding of the policy on breaking changes, since this bug prevents use of the changed feature, the change should be acceptable.
CDK CLI Version
2.1005.0
Node.js Version
v22.14.0
OS
Ubuntu 24.04.2 LTS
Language
TypeScript
Language Version
5.5.4