File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public struct Smithy {
106
106
PaginatedTrait . self,
107
107
HttpChecksumRequiredTrait . self,
108
108
HttpChecksumTrait . self,
109
+ RequestCompression . self,
109
110
// resource traits
110
111
NoReplaceTrait . self,
111
112
ReferencesTrait . self,
Original file line number Diff line number Diff line change @@ -91,3 +91,13 @@ public struct UnitTypeTrait: StaticTrait {
91
91
public var selector : Selector { TypeSelector < UnitShape > ( ) }
92
92
public init ( ) { }
93
93
}
94
+
95
+ /// Defines the shape to be a unit type similar to Void or None
96
+ public struct RequestCompression : StaticTrait {
97
+ public static var staticName : ShapeId = " smithy.api#requestCompression "
98
+ public var selector : Selector { TypeSelector < OperationShape > ( ) }
99
+ public let encodings : [ String ]
100
+ public init ( encodings: [ String ] ) {
101
+ self . encodings = encodings
102
+ }
103
+ }
Original file line number Diff line number Diff line change @@ -465,4 +465,29 @@ class TraitTests: XCTestCase {
465
465
let model = try Smithy ( ) . parse ( smithy)
466
466
try model. validate ( )
467
467
}
468
+
469
+ func testRequestCompression( ) throws {
470
+ let smithy = """
471
+ $version: " 2 "
472
+ namespace smithy.example
473
+
474
+ @requestCompression(
475
+ encodings: [ " gzip " ]
476
+ )
477
+ operation PutWithContentEncoding {
478
+ input: PutWithContentEncodingInput
479
+ }
480
+
481
+ @input
482
+ structure PutWithContentEncodingInput {
483
+ @httpHeader( " Content-Encoding " )
484
+ customEncoding: String // brotli
485
+
486
+ @httpPayload
487
+ data: String
488
+ }
489
+ """
490
+ let model = try Smithy ( ) . parse ( smithy)
491
+ try model. validate ( )
492
+ }
468
493
}
You can’t perform that action at this time.
0 commit comments