-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make httpPrefixHeaders
be coupled with required
#1228
Comments
We don't want people to have to provide an empty map on input. |
We could require that the member is marked as |
That test case is intended to assert that clients are not serializing anything when given an empty headers map, it doesn't really make any sense from a server perspective. So it should just be marked as client only. We could also add a server-only variant that omits the parameter. Making it required/default doesn't make sense. It does make sense for streaming since streams will always be there because that's just how the http interfaces work. That's not the case here though, except in the fringe case of an empty prefix. |
I think the behavior of the client and the server should be symmetric in this aspect.
Why? The crux of the matter is in the expressiveness of the wire format. How can HTTP headers convey the different semantics ascribed to a null/absent collection vs an empty collection? You need distinct syntaxes to convey different semantics. With JSON there's no problem ( |
I think Jordon's suggestion is fine if we don't make changes to the requirements of As for coupling
To address your specific concerns: httpPrefixHeaders can be bound to |
Consider this model from the protocol tests:
https://github.com/awslabs/smithy/blob/1863d672dde488ccd81d9c00c64f57a26728f75d/smithy-aws-protocol-tests/model/restJson1/http-prefix-headers.smithy#L81-L88
If a server receives a request with no headers prefixed with
X-Foo-
, should it give to the service owner an empty map forfooMap
, orNone
? The spec does not say. However, this test:https://github.com/awslabs/smithy/blob/1863d672dde488ccd81d9c00c64f57a26728f75d/smithy-aws-protocol-tests/model/restJson1/http-prefix-headers.smithy#L43-L57
when interpreted from a server perspective, is saying that the request should deserialize into an empty
fooMap
. So why allowfooMap
to be optional? Why not makehttpPrefixHeaders
be coupled withrequired
?The text was updated successfully, but these errors were encountered: