Skip to content
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

Clarifying questions on the restJson1 protocol spec #686

Closed
ghost opened this issue Jan 11, 2021 · 1 comment · Fixed by #692
Closed

Clarifying questions on the restJson1 protocol spec #686

ghost opened this issue Jan 11, 2021 · 1 comment · Fixed by #692

Comments

@ghost
Copy link

ghost commented Jan 11, 2021

I have a couple clarifying questions on the restJson1 spec.

Question 1

The spec states that the default Content-Type of application/json should be used, and that if there is a @httpPayload member, then there must be a Content-Type header and provides a table of possible values. What's not clear to me is what the expected behavior is when there are no members, or when there is no input/output shape on the operation. From what I can see in the protocol tests, the content type is application/json in these cases, but is that actually correct? Does it make sense to have a Content-Type when there is no content?

Tests I'm referencing:

I think I might be misunderstanding something.

Question 2

For HTTP headers in restJson1, I'm trying to figure out how the @sparse trait on lists/sets plays into header values. I couldn't find it mentioned in the spec, and didn't see any protocol tests that exercise it.

So if I have something like this:

@sparse
list SparseList {
    member: String
}

structure ExampleInput {
    @httpHeader("X-Example")
    example: SparseList,
}

Is this supported? If so, how are the null values expected to be serialized?

Thanks!

@mtdowling
Copy link
Member

Thanks for pointing out these issues! All the points from question 1 seem like they're issues in the protocol tests. I'm addressing those in this PR: #692

As for sparse lists in headers -- great question. It's currently undefined behavior, and I'm not really sure how we'd support sending a null header.

mtdowling added a commit that referenced this issue Jan 28, 2021
This commit fixes various protocol test issues for AWS JSON 1.0, 1.1,
and AWS REST JSON. In particular, this PR focuses on how request and
response payloads are formed when there is no defined input, no defined
output, an empty input, and an empty output. Various test cases have
been added that are tagged as either client-only or server-only to
ensure that both implementations are able to gracefully handle
different cases like en empty JSON object sent as the payload, or
omitting a payload altogether.

These test cases are based on actual observed behavior of AWS services
today. If we make changes to these protocols in the future, then we'll
update the protocol tests to reflect them (e.g., maybe we add support
for forcing an empty JSON object payload, omitting a payload, etc).

Closes #686
mtdowling added a commit that referenced this issue Jan 29, 2021
This commit fixes various protocol test issues for AWS JSON 1.0, 1.1,
and AWS REST JSON. In particular, this PR focuses on how request and
response payloads are formed when there is no defined input, no defined
output, an empty input, and an empty output. Various test cases have
been added that are tagged as either client-only or server-only to
ensure that both implementations are able to gracefully handle
different cases like en empty JSON object sent as the payload, or
omitting a payload altogether.

These test cases are based on actual observed behavior of AWS services
today. If we make changes to these protocols in the future, then we'll
update the protocol tests to reflect them (e.g., maybe we add support
for forcing an empty JSON object payload, omitting a payload, etc).

Closes #686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant