Fix codegen to ignore httpLabel on non-input shapes per Smithy spec#6789
Fix codegen to ignore httpLabel on non-input shapes per Smithy spec#6789
Conversation
dd6a8b4 to
cbb38f4
Compare
codegen/src/main/java/software/amazon/awssdk/codegen/AddShapes.java
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/AddShapes.java
Outdated
Show resolved
Hide resolved
codegen/src/test/resources/software/amazon/awssdk/codegen/uri-on-non-input-shape-service.json
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/AddShapes.java
Outdated
Show resolved
Hide resolved
| MemberModel requiredMemberModel = requestShapeModel.findMemberModelByC2jName(queryParamName); | ||
|
|
||
| assertThat(requestShapeModel.getRequired()).contains(queryParamName); | ||
| assertThat(requiredMemberModel.getHttp().getLocation()).isEqualTo(Location.QUERY_STRING); |
There was a problem hiding this comment.
why are we removing this assertion ?
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
I see here the MarshallLocation of existing test case is getting changed , any reason on why the existing shape is getting changed ?
There was a problem hiding this comment.
Same reason as above, "location":"querystring" on a nested member that is not an input/output/errors should go in the payload.
|



Per the Smithy spec, httpLabel on non-input shapes "has no meaning and is simply ignored." However,
AddShapes.findRequestUri()was throwing aModelInvalidExceptionwhen 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
requestUriis unchanged.