Skip to content

Fix codegen to ignore httpLabel on non-input shapes per Smithy spec#6789

Open
RanVaknin wants to merge 4 commits intomasterfrom
rvaknin/fix-codegen-locationUri
Open

Fix codegen to ignore httpLabel on non-input shapes per Smithy spec#6789
RanVaknin wants to merge 4 commits intomasterfrom
rvaknin/fix-codegen-locationUri

Conversation

@RanVaknin
Copy link
Contributor

@RanVaknin RanVaknin commented Mar 12, 2026

Per the Smithy spec, httpLabel on non-input shapes "has no meaning and is simply ignored." However, AddShapes.findRequestUri() was throwing a ModelInvalidException when it found a shape with a URI bound member that wasn't a direct operation input.

When the shape isn't a direct operation input, it now returns empty instead of throwing (results in codegen ignoring this member). The existing validation for operations with a missing requestUri is unchanged.

@RanVaknin RanVaknin requested a review from a team as a code owner March 12, 2026 21:36
@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 Mar 13, 2026
@RanVaknin RanVaknin force-pushed the rvaknin/fix-codegen-locationUri branch from dd6a8b4 to cbb38f4 Compare March 13, 2026 19:49
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@RanVaknin RanVaknin changed the title Include shape name in REQUEST_URI_NOT_FOUND validation error message Fix codegen to ignore httpLabel on non-input shapes per Smithy spec Mar 13, 2026
return ModelInvalidException.builder().validationEntries(Collections.singletonList(entry)).build();
});
if (!operation.isPresent()) {
// Not a direct operation input shape, should be ignored.
Copy link
Contributor

@joviegas joviegas Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does generated code looks like when we have below

  "NestedOptions": {
      "type": "structure",
      "members": {
        "pageSize": {
          "shape": "String",
          "location": "uri",
          "locationName": "pageSize"
        }
      }
    }

when we say

httpLabel is only considered when applied to top-level members of an operation's input structure. This trait has no meaning in any other context and is simply ignored.

what does ignore mean ? should we internally treat it as

  "NestedOptions": {
      "type": "structure",
      "members": {
        "pageSize": {
          "shape": "String",
          "locationName": "pageSize"
        }
      }
    }

and marshall it in the regular payload. , just as we do for shapes where locationName is not specified

Or completely remove pageSize from NestedOptions structure ?

Can we please have a test case comparing a generated code ?

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.

2 participants