Skip to content

Commit 7222baa

Browse files
committed
Add Wire Protocol Selection guide
These guidelines define how clients and servers should identify protocols and claim requests. Additional updates are made to each protocol defined in the specifiction to define the set of characteristics that servers must use to identify inputs from clients.
1 parent 44127a6 commit 7222baa

9 files changed

Lines changed: 406 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "documentation",
3+
"description": "Add Wire Protocol Selection guide",
4+
"pull_requests": [
5+
"[#2938](https://github.com/smithy-lang/smithy/pull/2938)"
6+
]
7+
}

docs/source-2.0/additional-specs/protocols/smithy-rpc-v2.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,25 @@ that affect serialization:
156156
to services.
157157

158158

159+
---------------------------
160+
Identification for claiming
161+
---------------------------
162+
163+
Services that support this protocol MUST use the following characteristics to
164+
identify and claim requests:
165+
166+
#. The Smithy-Protocol HTTP request header is set and contains the value
167+
``rpc-v2-cbor``.
168+
#. The HTTP request method is ``POST``.
169+
#. The HTTP request path matches the form ``{prefix?}/service/{serviceName}/operation/{operationName}``.
170+
#. The optional ``{prefix?}`` segment in the HTTP request path matches the
171+
service’s runtime path prefix, if configured.
172+
#. The ``{serviceName}`` segment in the HTTP request path matches the :token:`shape name <smithy:Identifier>`
173+
of the service's :ref:`shape-id` in the Smithy model.
174+
#. The ``{operationName}`` segment in the HTTP request path matches a :token:`shape name <smithy:Identifier>`
175+
of an operation bound to the service.
176+
177+
159178
------------------
160179
Protocol behaviors
161180
------------------

docs/source-2.0/aws/protocols/aws-ec2-query-protocol.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@ that affect serialization:
171171
This protocol does not support document types.
172172

173173

174+
---------------------------
175+
Identification for claiming
176+
---------------------------
177+
178+
Services that support this protocol MUST use the following characteristics to
179+
identify and claim requests:
180+
181+
#. The ``Content-Type`` HTTP request header is set and contains the value
182+
``application/x-www-form-urlencoded``.
183+
#. The HTTP request method is ``POST``.
184+
#. The HTTP request path is ``/``.
185+
#. The :token:`shape name <smithy:Identifier>` of the service's :ref:`shape-id`
186+
in the Smithy model is ``AmazonEC2``.
187+
#. The HTTP request body contains a ``Version`` key with its value set to the
188+
:ref:`"version" property of the service <service>`.
189+
#. The HTTP request body contains an ``Action`` key with a value that matches a
190+
:token:`shape name <smithy:Identifier>` of an operation bound to the service.
191+
192+
174193
.. |quoted shape name| replace:: ``ec2Query``
175194
.. |name resolution text| replace:: See :ref:`aws.protocols#ec2QueryName-query-key-naming`
176195
for how to serialize a property using a custom name

docs/source-2.0/aws/protocols/aws-json.rst.template

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ that affect serialization:
2525
to services.
2626

2727

28+
---------------------------
29+
Identification for claiming
30+
---------------------------
31+
32+
Services that support this protocol MUST use the following characteristics to
33+
identify and claim requests:
34+
35+
#. The ``Content-Type`` HTTP request header is set and contains the value
36+
|protocol content type|.
37+
#. The HTTP request method is ``POST``.
38+
#. The HTTP request path is ``/``.
39+
#. The ``X-Amz-Target`` HTTP request header is set and contains a value that
40+
matches the form ``{serviceName}.{operationName}``.
41+
#. The ``{serviceName}`` segment in the ``X-Amz-Target`` HTTP request header
42+
matches the :token:`shape name <smithy:Identifier>` of the service's
43+
:ref:`shape-id` in the Smithy model.
44+
#. The ``{operationName}`` segment in the ``X-Amz-Target`` HTTP request header
45+
matches a :token:`shape name <smithy:Identifier>` of an operation bound to
46+
the service.
47+
48+
2849
------------------
2950
Protocol Behaviors
3051
------------------

docs/source-2.0/aws/protocols/aws-query-protocol.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,24 @@ that affect serialization:
9393
- Indicates that an operation supports compressing requests from clients
9494
to services.
9595

96+
97+
---------------------------
98+
Identification for claiming
99+
---------------------------
100+
101+
Services that support this protocol MUST use the following characteristics to
102+
identify and claim requests:
103+
104+
#. The ``Content-Type`` HTTP request header is set and contains the value
105+
``application/x-www-form-urlencoded``.
106+
#. The HTTP request method is ``POST``.
107+
#. The HTTP request path is ``/``.
108+
#. The HTTP request body contains a ``Version`` key with its value set to the
109+
:ref:`"version" property of the service <service>`.
110+
#. The HTTP request body contains an ``Action`` key with a value that matches a
111+
:token:`shape name <smithy:Identifier>` of an operation bound to the service.
112+
113+
96114
.. |quoted shape name| replace:: ``awsQuery``
97115
.. |name resolution text| replace:: The :ref:`xmlName-trait` can be used to serialize a property using a custom name
98116
.. |query list text| replace::

docs/source-2.0/aws/protocols/aws-restjson1-protocol.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,25 @@ that affect serialization:
189189
to services.
190190

191191

192+
---------------------------
193+
Identification for claiming
194+
---------------------------
195+
196+
Services that support this protocol MUST use the following characteristics to
197+
identify and claim requests:
198+
199+
#. The pair of HTTP request method and HTTP request path matches the defined
200+
method and path of an operation bound to the service.
201+
#. The ``Content-Type`` HTTP request header is set and contains a value that
202+
matches :ref:`the operation’s input’s derived Content-Type <restJson1-content-type>`
203+
or is allowed to contain a custom ``Content-Type`` via the ``@httpHeader``
204+
trait.
205+
206+
This defaults to ``application/json``.
207+
208+
209+
.. _restJson1-content-type:
210+
192211
------------
193212
Content-Type
194213
------------

docs/source-2.0/aws/protocols/aws-restxml-protocol.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,25 @@ that affect serialization:
192192
This protocol does not support document types.
193193

194194

195+
---------------------------
196+
Identification for claiming
197+
---------------------------
198+
199+
Services that support this protocol MUST use the following characteristics to
200+
identify and claim requests:
201+
202+
#. The pair of HTTP request method and HTTP request path matches the defined
203+
method and path of an operation bound to the service.
204+
#. The ``Content-Type`` HTTP request header is set and contains a value that
205+
matches :ref:`the operation’s input’s derived Content-Type <restXml-content-type>`
206+
or is allowed to contain a custom ``Content-Type`` via the ``@httpHeader``
207+
trait.
208+
209+
This defaults to ``application/xml``.
210+
211+
212+
.. _restXml-content-type:
213+
195214
------------
196215
Content-Type
197216
------------

docs/source-2.0/guides/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Guides
1212
model-linters
1313
model-validation-examples
1414
evolving-models
15+
wire-protocol-selection
1516
style-guide
1617
model-translations/index
1718
building-codegen/index

0 commit comments

Comments
 (0)