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

Update @httpResponseCode to not be applicable to @input structures #1359

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docs/source-1.0/spec/core/http-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1137,10 +1137,11 @@ Summary
Trait selector
.. code-block:: none

structure > member :test(> integer)
structure :not([trait|input]) > member :test(> integer)

The ``httpResponseCode`` trait can be applied to ``structure`` members
that target an ``integer``.
that target an ``integer`` within any ``structure`` that has no ``input``
trait applied.
Value type
Annotation trait.
Conflicts with
Expand All @@ -1157,12 +1158,12 @@ to the `code` set by the :ref:`http-trait`.

.. rubric:: ``httpResponseCode`` is only used on output

``httpResponseCode`` is ignored when resolving the HTTP bindings of an
operation's input structure. This means that if a structure that contains
members marked with the ``httpResponseCode`` trait is used as the top-level
input structure of an operation, then those members are sent as part of the
:ref:`protocol-specific document <http-protocol-document-payloads>` sent in
the body of the request.
``httpResponseCode`` is ignored when resolving the HTTP bindings of any
syall marked this conversation as resolved.
Show resolved Hide resolved
structure except an operation's output structure. This means that if a
structure that contains members marked with the ``httpResponseCode`` trait
is not used as an output structure of an operation, then those members are
sent as part of the :ref:`protocol-specific document <http-protocol-document-payloads>`
sent in the body of the request.


.. smithy-trait:: smithy.api#cors
Expand Down
17 changes: 9 additions & 8 deletions docs/source-2.0/spec/http-bindings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1139,10 +1139,11 @@ Summary
Trait selector
.. code-block:: none

structure > member :test(> integer)
structure :not([trait|input]) > member :test(> integer)

The ``httpResponseCode`` trait can be applied to ``structure`` members
that target an ``integer``.
that target an ``integer`` within any ``structure`` that has no ``input``
trait applied.
Value type
Annotation trait.
Conflicts with
Expand All @@ -1159,12 +1160,12 @@ to the `code` set by the :ref:`http-trait`.

.. rubric:: ``httpResponseCode`` is only used on output

``httpResponseCode`` is ignored when resolving the HTTP bindings of an
operation's input structure. This means that if a structure that contains
members marked with the ``httpResponseCode`` trait is used as the top-level
input structure of an operation, then those members are sent as part of the
:ref:`protocol-specific document <http-protocol-document-payloads>` sent in
the body of the request.
``httpResponseCode`` is ignored when resolving the HTTP bindings of any
structure except an operation's output structure. This means that if a
structure that contains members marked with the ``httpResponseCode`` trait
is not used as an output structure of an operation, then those members are
sent as part of the :ref:`protocol-specific document <http-protocol-document-payloads>`
sent in the body of the request.


.. smithy-trait:: smithy.api#cors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ integer httpError
/// status code. The value MAY differ from the HTTP status code provided
/// on the response.
@trait(
selector: "structure > member :test(> integer)",
selector: "structure :not([trait|input]) > member :test(> integer)",
structurallyExclusive: "member",
conflicts: [httpLabel, httpQuery, httpHeader, httpPrefixHeaders, httpPayload, httpQueryParams],
breakingChanges: [{change: "any"}]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ERROR] ns.foo#HttpOperationInput$Int: Trait `httpResponseCode` cannot be applied to `ns.foo#HttpOperationInput$Int`. This trait may only be applied to shapes that match the following selector: structure :not([trait|input]) > member :test(> integer) | TraitTarget
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$version: "2.0"

namespace ns.foo

@input
structure HttpOperationInput {

@httpResponseCode
Int: Integer

}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[ERROR] ns.foo#HttpOperationInput$Int: Found conflicting traits on member shape: `httpHeader` conflicts with `httpLabel`, `httpHeader` conflicts with `httpQuery`, `httpHeader` conflicts with `httpResponseCode`, `httpLabel` conflicts with `httpHeader`, `httpLabel` conflicts with `httpQuery`, `httpLabel` conflicts with `httpResponseCode`, `httpQuery` conflicts with `httpHeader`, `httpQuery` conflicts with `httpLabel`, `httpQuery` conflicts with `httpResponseCode`, `httpResponseCode` conflicts with `httpHeader`, `httpResponseCode` conflicts with `httpLabel`, `httpResponseCode` conflicts with `httpQuery` | TraitConflict
[ERROR] ns.foo#HttpOperationOutput$Int: Found conflicting traits on member shape: `httpHeader` conflicts with `httpLabel`, `httpHeader` conflicts with `httpQuery`, `httpHeader` conflicts with `httpResponseCode`, `httpLabel` conflicts with `httpHeader`, `httpLabel` conflicts with `httpQuery`, `httpLabel` conflicts with `httpResponseCode`, `httpQuery` conflicts with `httpHeader`, `httpQuery` conflicts with `httpLabel`, `httpQuery` conflicts with `httpResponseCode`, `httpResponseCode` conflicts with `httpHeader`, `httpResponseCode` conflicts with `httpLabel`, `httpResponseCode` conflicts with `httpQuery` | TraitConflict

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$version: "2.0"

namespace ns.foo

@output
structure HttpOperationOutput {

@required
@httpResponseCode
@httpLabel
@httpQuery("foo")
@httpHeader("x-amz-foo")
Int: Integer

}