diff --git a/docs/source-2.0/aws/protocols/aws-query-protocol.rst b/docs/source-2.0/aws/protocols/aws-query-protocol.rst index b917034423a..526ab0820c9 100644 --- a/docs/source-2.0/aws/protocols/aws-query-protocol.rst +++ b/docs/source-2.0/aws/protocols/aws-query-protocol.rst @@ -562,7 +562,7 @@ Summary :ref:`awsQueryError `, and ``Fault`` is one of ``Sender`` or ``Receiver``. Trait selector - ``service [trait|awsJson1_0]`` + ``service :test([trait|aws.protocols#awsJson1_0], [trait|smithy.protocols#rpcv2Cbor])`` Value type Annotation trait diff --git a/smithy-aws-traits/build.gradle.kts b/smithy-aws-traits/build.gradle.kts index a4ae351aa43..97ace4626b1 100644 --- a/smithy-aws-traits/build.gradle.kts +++ b/smithy-aws-traits/build.gradle.kts @@ -14,4 +14,5 @@ extra["moduleName"] = "software.amazon.smithy.aws.traits" dependencies { api(project(":smithy-diff")) api(project(":smithy-model")) + api(project(":smithy-protocol-traits")) } diff --git a/smithy-aws-traits/src/main/resources/META-INF/smithy/aws.protocols.smithy b/smithy-aws-traits/src/main/resources/META-INF/smithy/aws.protocols.smithy index 16fbbfb2be9..311eb977929 100644 --- a/smithy-aws-traits/src/main/resources/META-INF/smithy/aws.protocols.smithy +++ b/smithy-aws-traits/src/main/resources/META-INF/smithy/aws.protocols.smithy @@ -86,8 +86,9 @@ structure awsQueryError { httpResponseCode: Integer } -/// Enable backward compatibility when migrating from awsQuery to awsJson protocol -@trait(selector: "service [trait|aws.protocols#awsJson1_0]") +/// Enable backward compatibility when migrating from awsQuery to the awsJson +/// protocol or Smithy RPC v2 CBOR. +@trait(selector: "service :test([trait|aws.protocols#awsJson1_0], [trait|smithy.protocols#rpcv2Cbor])") structure awsQueryCompatible {} /// An RPC-based protocol that sends 'POST' requests in the body as Amazon EC2 diff --git a/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/aws-query-compatible.smithy b/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/aws-query-compatible.smithy index a748c687ef5..25b6828743d 100644 --- a/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/aws-query-compatible.smithy +++ b/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/aws-query-compatible.smithy @@ -5,6 +5,7 @@ namespace smithy.example use aws.protocols#awsQueryCompatible use aws.protocols#awsQueryError use aws.protocols#awsJson1_0 +use smithy.protocols#rpcv2Cbor @awsQueryCompatible @awsJson1_0 @@ -21,3 +22,10 @@ service MyService { structure InvalidThingException { message: String } + +@awsQueryCompatible +@rpcv2Cbor +service MyService2 { + version: "2020-02-05", + errors: [InvalidThingException] +} diff --git a/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/protocols/aws-query-compatible-does-not-support-non-aws-json.errors b/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/protocols/aws-query-compatible-does-not-support-non-aws-json.errors index af5c295f0ff..c2bd3a1f9fc 100644 --- a/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/protocols/aws-query-compatible-does-not-support-non-aws-json.errors +++ b/smithy-aws-traits/src/test/resources/software/amazon/smithy/aws/traits/errorfiles/protocols/aws-query-compatible-does-not-support-non-aws-json.errors @@ -1,2 +1,2 @@ [WARNING] smithy.example#MyService: This shape applies a trait that is deprecated: aws.protocols#awsQuery | DeprecatedTrait -[ERROR] smithy.example#MyService: Trait `aws.protocols#awsQueryCompatible` cannot be applied to `smithy.example#MyService`. This trait may only be applied to shapes that match the following selector: service [trait|aws.protocols#awsJson1_0] | TraitTarget +[ERROR] smithy.example#MyService: Trait `aws.protocols#awsQueryCompatible` cannot be applied to `smithy.example#MyService`. This trait may only be applied to shapes that match the following selector: service :test([trait|aws.protocols#awsJson1_0], [trait|smithy.protocols#rpcv2Cbor]) | TraitTarget