diff --git a/codegen-core/common-test-models/misc.smithy b/codegen-core/common-test-models/misc.smithy index c3449feb28eb19fdcf2cba66b5db573dbaeddb96..a98c0fa21fecba37390208323714f8c74564dcff 100644 --- a/codegen-core/common-test-models/misc.smithy +++ b/codegen-core/common-test-models/misc.smithy @@ -14,7 +14,8 @@ use smithy.test#httpResponseTests service MiscService { operations: [ TypeComplexityOperation, - InnerRequiredShapeOperation, + RequiredInnerShapeOperation, + RequiredHeaderCollectionOperation, ResponseCodeRequiredOperation, ResponseCodeHttpFallbackOperation, ResponseCodeDefaultOperation, @@ -54,12 +55,12 @@ map MapA { /// This operation tests that (de)serializing required values from a nested /// shape works correctly. @http(uri: "/innerRequiredShapeOperation", method: "POST") -operation InnerRequiredShapeOperation { - input: InnerRequiredShapeOperationInputOutput, - output: InnerRequiredShapeOperationInputOutput, +operation RequiredInnerShapeOperation { + input: RequiredInnerShapeOperationInputOutput, + output: RequiredInnerShapeOperationInputOutput, } -structure InnerRequiredShapeOperationInputOutput { +structure RequiredInnerShapeOperationInputOutput { inner: InnerShape } @@ -230,3 +231,27 @@ structure ResponseCodeRequiredOutput { } ]) operation AcceptHeaderStarService {} + +@http(uri: "/required-header-collection-operation", method: "GET") +operation RequiredHeaderCollectionOperation { + input: RequiredHeaderCollectionOperationInputOutput, + output: RequiredHeaderCollectionOperationInputOutput, +} + +structure RequiredHeaderCollectionOperationInputOutput { + @required + @httpHeader("X-Required-List") + requiredHeaderList: HeaderList, + + @required + @httpHeader("X-Required-Set") + requiredHeaderSet: HeaderSet, +} + +list HeaderList { + member: String +} + +set HeaderSet { + member: String +} diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt index 47e1240a09191ac534f2148d4dee4e184fc1f7e7..8d089ef8bce1bcb7cd86b2559f8c6ab195772bd9 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt @@ -365,7 +365,6 @@ class HttpBindingGenerator( rust("let $parsedValue = $parsedValue?;") } } - // TODO(https://github.com/awslabs/smithy-rs/issues/837): this doesn't support non-optional vectors when (rustType) { is RustType.Vec -> rust(