Skip to content

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

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

Fix codegen to ignore httpLabel on non-input shapes per Smithy spec#6789
RanVaknin wants to merge 9 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
@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
MemberModel requiredMemberModel = requestShapeModel.findMemberModelByC2jName(queryParamName);

assertThat(requestShapeModel.getRequired()).contains(queryParamName);
assertThat(requiredMemberModel.getHttp().getLocation()).isEqualTo(Location.QUERY_STRING);
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we removing this assertion ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it was asserting the buggy behavior. NestedQueryParameterOperation is not a direct operation input/output/errors.
I should have added an assert null instead (null would result in the default behavior of it being serialized to the payload instead)

.getter(getter(NestedQueryParameterOperation::queryParamOne))
.setter(setter(Builder::queryParamOne))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("QueryParamOne").build(),
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryParamOne").build(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I see here the MarshallLocation of existing test case is getting changed , any reason on why the existing shape is getting changed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason as above, "location":"querystring" on a nested member that is not an input/output/errors should go in the payload.

@sonarqubecloud
Copy link

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