Skip to content

aws-apigateway: JsonSchema additionalItems is undeployable #33878

@jusdino

Description

@jusdino

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 JsonSchema or boolean, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-apigatewayRelated to Amazon API GatewaybugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions