Skip to content

Add new codgen processor to throw ModelInvalidException on naming case and type collisions instead of NPE#7167

Open
RanVaknin wants to merge 2 commits into
masterfrom
rvaknin/fix-codgen-naming-collisions
Open

Add new codgen processor to throw ModelInvalidException on naming case and type collisions instead of NPE#7167
RanVaknin wants to merge 2 commits into
masterfrom
rvaknin/fix-codgen-naming-collisions

Conversation

@RanVaknin

@RanVaknin RanVaknin commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Adds a codegen processor that throws a typed exception when a model has two shapes whose names differ only in the case of their first letter AND have different types.

Example:

    "shapes": {
      "Endpoint": {
        "type": "structure",
        "members": {}
      },
      "endpoint": {
        "type": "string"
      }

Codegen capitalizes the first letter of each shape name to derive its Java class name, so both Endpoint and endpoint map to the class Endpoint.java. Codegen keys its shape map by that class name, so one shape silently overwrites the other, and a member still referencing the lost shape later can cause a codegen time error (observed as an NPE).

The processor only flags collisions where the two shapes have different types. Same type collisions produce equivalent output, so the overwrite is harmless.

The new processor detects when two shapes of different types map to the same generated class name, and throws a single ModelInvalidException listing every collision found.

@RanVaknin RanVaknin added changelog-not-required Indicate changelog entry is not required for a specific PR no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required labels Jul 20, 2026
@RanVaknin
RanVaknin marked this pull request as ready for review July 20, 2026 21:55
@RanVaknin
RanVaknin requested a review from a team as a code owner July 20, 2026 21:55
@RanVaknin
RanVaknin force-pushed the rvaknin/fix-codgen-naming-collisions branch from a88192f to 9e8733f Compare July 20, 2026 22:41
@RanVaknin RanVaknin changed the title Add new codgen processor to throw ModelInvalidException on case colli… Add new codgen processor to throw ModelInvalidException on naming case and type collisions instead of NPE Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-not-required Indicate changelog entry is not required for a specific PR no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant