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

Rewrite IDL v2 model loading #1317

Merged
merged 20 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 19 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
20 changes: 6 additions & 14 deletions designs/defaults-and-model-evolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ This proposal:
1. Introduces a `@default` trait
2. Introduces a `@clientOptional` trait
3. Removes the `@box` trait
4. Removes the `Primitive*` shapes from the prelude
4. Deprecates the `Primitive*` shapes from the prelude
5. Make the optionality of a structure completely controlled by members rather
than the shape targeted by a member

Expand Down Expand Up @@ -195,19 +195,11 @@ optionality controls from shapes to structure members. Smithy IDL 2.0 will:
version bump of the service.
3. Remove the `@box` trait from the Smithy 2.0 prelude and fail to load models
that contain the `@box` trait.
4. Remove the `PrimitiveBoolean`, `PrimitiveShort`, `PrimitiveInteger`,
`PrimitiveLong`, `PrimitiveFloat`, and `PrimitiveDouble` shapes from the
Smithy 2.0 prelude. IDL 2.0 models will fail if they use these shapes.
5. Update the Smithy IDL 2.0 model loader implementation to be able to load
Smithy 1.0 models alongside Smithy 2.0 models.
1. Inject an appropriate `@default` trait on structure members that targeted
shapes with a default zero value and were not marked with the `@box`
trait.
2. Replace the `@box` trait with `@clientOptional` on structure members.
3. Remove the `@box` trait from non-members.
4. Rewrite members that target one of the removed Primitive* shapes to
target the corresponding non-primitive shape in the prelude (for example,
`PrimitiveInteger` is rewritten to target `Integer`).
4. Deprecate the `PrimitiveBoolean`, `PrimitiveShort`, `PrimitiveInteger`,
`PrimitiveLong`, `PrimitiveFloat`, and `PrimitiveDouble` shapes in the
Smithy 2.0 prelude. These shapes are treated exactly the same as their
prelude counterparts not prefixed with "Primitive", so there is no need to
use these shapes.


## `@default` trait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ that support the following members:
- **Required**. The identifier of the test case. This identifier can
be used by protocol test implementations to filter out unsupported
test cases by ID, to generate test case names, etc. The provided
``id`` MUST match Smithy's :token:`smithy:identifier` ABNF. No two
``id`` MUST match Smithy's :token:`smithy:Identifier` ABNF. No two
``httpRequestTests`` test cases can share the same ID.
* - protocol
- shape ID
Expand Down Expand Up @@ -346,7 +346,7 @@ structures that support the following members:
- **Required**. The identifier of the test case. This identifier can
be used by protocol test implementations to filter out unsupported
test cases by ID, to generate test case names, etc. The provided
``id`` MUST match Smithy's :token:`smithy:identifier` ABNF. No two
``id`` MUST match Smithy's :token:`smithy:Identifier` ABNF. No two
``httpResponseTests`` test cases can share the same ID.
* - protocol
- ``string``
Expand Down Expand Up @@ -554,7 +554,7 @@ The ``httpMalformedRequestTests`` trait is a list of
- **Required**. The identifier of the test case. This identifier can
be used by protocol test implementations to filter out unsupported
test cases by ID, to generate test case names, etc. The provided
``id`` MUST match Smithy's :token:`smithy:identifier` ABNF. No two
``id`` MUST match Smithy's :token:`smithy:Identifier` ABNF. No two
``httpMalformedRequestTests`` test cases can share the same ID.
* - protocol
- shape ID
Expand Down
8 changes: 4 additions & 4 deletions docs/source-2.0/aws/protocols/aws-ec2-query-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ resolved using the following process:
* - Member location
- Default value
* - ``structure`` member
- The :token:`member name <smithy:shape_id_member>` capitalized
- The :token:`member name <smithy:ShapeIdMember>` capitalized
* - ``union`` member
- The :token:`member name <smithy:shape_id_member>` capitalized
- The :token:`member name <smithy:ShapeIdMember>` capitalized


----------------
Expand Down Expand Up @@ -317,7 +317,7 @@ of the ``Errors`` tag is an ``Error`` tag which contains the serialized error
structure members.

Serialized error shapes MUST also contain an additional child element ``Code``
that contains only the :token:`shape name <smithy:identifier>` of the error's
that contains only the :token:`shape name <smithy:Identifier>` of the error's
:ref:`shape-id`. This can be used to distinguish which specific error has been
serialized in the response.

Expand All @@ -334,7 +334,7 @@ serialized in the response.
<RequestId>foo-id</RequestId>
</Response>

* ``Code``: The :token:`shape name <smithy:identifier>` of the error's
* ``Code``: The :token:`shape name <smithy:Identifier>` of the error's
:ref:`shape-id`.
* ``RequestId``: Contains a unique identifier for the associated request.

Expand Down
2 changes: 1 addition & 1 deletion docs/source-2.0/aws/protocols/aws-json-1_1-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ The following example defines a service that requires the use of

.. |quoted shape name| replace:: ``awsJson1_1``
.. |protocol content type| replace:: ``application/x-amz-json-1.1``
.. |protocol error type contents| replace:: :token:`shape name <smithy:identifier>`
.. |protocol error type contents| replace:: :token:`shape name <smithy:Identifier>`
.. |protocol test link| replace:: https://github.com/awslabs/smithy/tree/main/smithy-aws-protocol-tests/model/awsJson1_1
.. include:: aws-json.rst.template

Expand Down
6 changes: 3 additions & 3 deletions docs/source-2.0/aws/protocols/aws-json.rst.template
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ The |quoted shape name| protocol uses the following headers:
`RFC 7230 Section 3.3.2`_.
* - ``X-Amz-Target``
- true for requests
- The value of this header is the :token:`shape name <smithy:identifier>` of the
- The value of this header is the :token:`shape name <smithy:Identifier>` of the
service's :ref:`shape-id` joined to the
:token:`shape name <smithy:identifier>` of the operation's :ref:`shape-id`,
:token:`shape name <smithy:Identifier>` of the operation's :ref:`shape-id`,
separated by a single period (``.``) character.

For example, the value for the operation ``ns.example#MyOp`` of the
Expand Down Expand Up @@ -191,7 +191,7 @@ There are two difference between :ref:`awsJson1_0 <aws.protocols#awsJson1_0-trai
Second, error type serialization is different. In ``awsJson1_0``, servers SHOULD
send the error shape's full :ref:`shape-id` in the ``__type`` field of the body.
In ``awsJson1_1``, servers SHOULD only send the error's
:token:`shape name <smithy:identifier>`. However, clients MUST accept either behavior
:token:`shape name <smithy:Identifier>`. However, clients MUST accept either behavior
for both protocols. See `Operation error serialization`_ for full details on how to
deserialize errors for |quoted shape name|.

Expand Down
6 changes: 3 additions & 3 deletions docs/source-2.0/aws/protocols/aws-query-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ resolved using the following process:
* - ``map`` value
- The string literal "value"
* - ``structure`` member
- The :token:`member name <smithy:shape_id_member>`
- The :token:`member name <smithy:ShapeIdMember>`
* - ``union`` member
- The :token:`member name <smithy:shape_id_member>`
- The :token:`member name <smithy:ShapeIdMember>`


Example requests
Expand Down Expand Up @@ -436,7 +436,7 @@ following process:

1. Use the value of the ``code`` member of the :ref:`aws.protocols#awsQueryError-trait`
applied to the error structure, if present.
2. The :token:`shape name <smithy:identifier>` of the error's :ref:`shape-id`.
2. The :token:`shape name <smithy:Identifier>` of the error's :ref:`shape-id`.


.. smithy-trait:: aws.protocols#awsQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Requests MUST include the following key value pairs in the serialized body:
* - Key
- Value
* - ``Action``
- The :token:`shape name <smithy:identifier>` of the operation's :ref:`shape-id`.
- The :token:`shape name <smithy:Identifier>` of the operation's :ref:`shape-id`.
* - ``Version``
- The value of the :ref:`"version" property of the service <service>`.

Expand Down
2 changes: 1 addition & 1 deletion docs/source-2.0/aws/protocols/aws-restjson1-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ is contained. New server-side protocol implementations MUST use a header field
named ``X-Amzn-Errortype``. Clients MUST accept any one of the following: an
additional header with the name ``X-Amzn-Errortype``, a body field with the
name ``__type``, or a body field named ``code``. The value of this component
SHOULD contain only the :token:`shape name <smithy:identifier>` of the error's
SHOULD contain only the :token:`shape name <smithy:Identifier>` of the error's
:ref:`shape-id`.

Legacy server-side protocol implementations sometimes include additional
Expand Down
4 changes: 2 additions & 2 deletions docs/source-2.0/aws/protocols/aws-restxml-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ contains the serialized error structure members, unless bound to another
location with HTTP protocol bindings.

Serialized error shapes MUST also contain an additional child element ``Code``
that contains only the :token:`shape name <smithy:identifier>` of the error's
that contains only the :token:`shape name <smithy:Identifier>` of the error's
:ref:`shape-id`. This can be used to distinguish which specific error has been
serialized in the response.

Expand Down Expand Up @@ -293,7 +293,7 @@ Error responses contain the following nested elements:
* ``Error``: A container for the encountered error.
* ``Type``: One of "Sender" or "Receiver"; whomever is at fault from the
service perspective.
* ``Code``: The :token:`shape name <smithy:identifier>` of the error's
* ``Code``: The :token:`shape name <smithy:Identifier>` of the error's
:ref:`shape-id`.
* ``RequestId``: Contains a unique identifier for the associated request.

Expand Down
2 changes: 1 addition & 1 deletion docs/source-2.0/spec/behavior-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ member in the previously referenced structure. Paths MUST adhere to the
following ABNF.

.. productionlist:: smithy
path :`identifier` *("." `identifier`)
path :`Identifier` *("." `Identifier`)

The following example defines a paginated operation which uses a result
wrapper where the output token and items are referenced by paths.
Expand Down
Loading