Skip to content

Commit a98f4d5

Browse files
authored
fix!: Remove suffix 'Response' from operation output type names (#599)
1 parent 7bf5b8c commit a98f4d5

35 files changed

+326
-326
lines changed

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/model/AddOperationShapes.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ class AddOperationShapes {
5454
.map { shapeId ->
5555
cloneOperationShape(
5656
operationId, (model.expectShape(shapeId) as StructureShape),
57-
"OutputResponse"
57+
"Output"
5858
)
5959
}
60-
.orElseGet { emptyOperationStructure(operationId, "OutputResponse", moduleName) }
60+
.orElseGet { emptyOperationStructure(operationId, "Output", moduleName) }
6161

6262
// Add new input/output to model
6363
modelBuilder.addShape(inputShape)

smithy-swift-codegen/src/test/kotlin/ContentMd5MiddlewareTests.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class ContentMd5MiddlewareTests {
1313
///
1414
/// - Parameter IdempotencyTokenWithStructureInput : [no documentation found]
1515
///
16-
/// - Returns: `IdempotencyTokenWithStructureOutputResponse` : [no documentation found]
17-
public func idempotencyTokenWithStructure(input: IdempotencyTokenWithStructureInput) async throws -> IdempotencyTokenWithStructureOutputResponse
16+
/// - Returns: `IdempotencyTokenWithStructureOutput` : [no documentation found]
17+
public func idempotencyTokenWithStructure(input: IdempotencyTokenWithStructureInput) async throws -> IdempotencyTokenWithStructureOutput
1818
{
1919
let context = ClientRuntime.HttpContextBuilder()
2020
.withEncoder(value: encoder)
@@ -26,24 +26,24 @@ class ContentMd5MiddlewareTests {
2626
.withLogger(value: config.logger)
2727
.withPartitionID(value: config.partitionID)
2828
.build()
29-
var operation = ClientRuntime.OperationStack<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutputResponse, IdempotencyTokenWithStructureOutputError>(id: "idempotencyTokenWithStructure")
30-
operation.initializeStep.intercept(position: .after, id: "IdempotencyTokenMiddleware") { (context, input, next) -> ClientRuntime.OperationOutput<IdempotencyTokenWithStructureOutputResponse> in
29+
var operation = ClientRuntime.OperationStack<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutput, IdempotencyTokenWithStructureOutputError>(id: "idempotencyTokenWithStructure")
30+
operation.initializeStep.intercept(position: .after, id: "IdempotencyTokenMiddleware") { (context, input, next) -> ClientRuntime.OperationOutput<IdempotencyTokenWithStructureOutput> in
3131
let idempotencyTokenGenerator = context.getIdempotencyTokenGenerator()
3232
var copiedInput = input
3333
if input.token == nil {
3434
copiedInput.token = idempotencyTokenGenerator.generateToken()
3535
}
3636
return try await next.handle(context: context, input: copiedInput)
3737
}
38-
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutputResponse, IdempotencyTokenWithStructureOutputError>())
39-
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutputResponse>())
40-
operation.buildStep.intercept(position: .before, middleware: ClientRuntime.ContentMD5Middleware<IdempotencyTokenWithStructureOutputResponse>())
41-
operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutputResponse>(contentType: "application/xml"))
42-
operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutputResponse>(xmlName: "IdempotencyToken"))
38+
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutput, IdempotencyTokenWithStructureOutputError>())
39+
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutput>())
40+
operation.buildStep.intercept(position: .before, middleware: ClientRuntime.ContentMD5Middleware<IdempotencyTokenWithStructureOutput>())
41+
operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutput>(contentType: "application/xml"))
42+
operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware<IdempotencyTokenWithStructureInput, IdempotencyTokenWithStructureOutput>(xmlName: "IdempotencyToken"))
4343
operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware())
44-
operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware<ClientRuntime.DefaultRetryStrategy, ClientRuntime.DefaultRetryErrorInfoProvider, IdempotencyTokenWithStructureOutputResponse, IdempotencyTokenWithStructureOutputError>(options: config.retryStrategyOptions))
45-
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware<IdempotencyTokenWithStructureOutputResponse, IdempotencyTokenWithStructureOutputError>())
46-
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware<IdempotencyTokenWithStructureOutputResponse, IdempotencyTokenWithStructureOutputError>(clientLogMode: config.clientLogMode))
44+
operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware<ClientRuntime.DefaultRetryStrategy, ClientRuntime.DefaultRetryErrorInfoProvider, IdempotencyTokenWithStructureOutput, IdempotencyTokenWithStructureOutputError>(options: config.retryStrategyOptions))
45+
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware<IdempotencyTokenWithStructureOutput, IdempotencyTokenWithStructureOutputError>())
46+
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware<IdempotencyTokenWithStructureOutput, IdempotencyTokenWithStructureOutputError>(clientLogMode: config.clientLogMode))
4747
let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler())
4848
return result
4949
}

smithy-swift-codegen/src/test/kotlin/HttpBindingProtocolGeneratorTests.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ class HttpBindingProtocolGeneratorTests {
6666

6767
@Test
6868
fun `it creates correct init for explicit struct payloads`() {
69-
val contents = getModelFileContents("example", "ExplicitStructOutputResponse+HttpResponseBinding.swift", newTestContext.manifest)
69+
val contents = getModelFileContents("example", "ExplicitStructOutput+HttpResponseBinding.swift", newTestContext.manifest)
7070
contents.shouldSyntacticSanityCheck()
7171
val expectedContents =
7272
"""
73-
extension ExplicitStructOutputResponse: ClientRuntime.HttpResponseBinding {
73+
extension ExplicitStructOutput: ClientRuntime.HttpResponseBinding {
7474
public init(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws {
7575
if let data = try await httpResponse.body.readData(), let responseDecoder = decoder {
7676
let output: Nested2 = try responseDecoder.decode(responseBody: data)
@@ -92,12 +92,12 @@ extension ExplicitStructOutputResponse: ClientRuntime.HttpResponseBinding {
9292
}
9393

9494
@Test
95-
fun `httpResponseCodeOutputResponse response init content`() {
96-
val contents = getModelFileContents("example", "HttpResponseCodeOutputResponse+HttpResponseBinding.swift", newTestContext.manifest)
95+
fun `httpResponseCodeOutput response init content`() {
96+
val contents = getModelFileContents("example", "HttpResponseCodeOutput+HttpResponseBinding.swift", newTestContext.manifest)
9797
contents.shouldSyntacticSanityCheck()
9898
val expectedContents =
9999
"""
100-
extension HttpResponseCodeOutputResponse: ClientRuntime.HttpResponseBinding {
100+
extension HttpResponseCodeOutput: ClientRuntime.HttpResponseBinding {
101101
public init(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws {
102102
self.status = httpResponse.statusCode.rawValue
103103
}
@@ -108,11 +108,11 @@ extension HttpResponseCodeOutputResponse: ClientRuntime.HttpResponseBinding {
108108

109109
@Test
110110
fun `decode the document type in HttpResponseBinding`() {
111-
val contents = getModelFileContents("example", "InlineDocumentAsPayloadOutputResponse+HttpResponseBinding.swift", newTestContext.manifest)
111+
val contents = getModelFileContents("example", "InlineDocumentAsPayloadOutput+HttpResponseBinding.swift", newTestContext.manifest)
112112
contents.shouldSyntacticSanityCheck()
113113
val expectedContents =
114114
"""
115-
extension InlineDocumentAsPayloadOutputResponse: ClientRuntime.HttpResponseBinding {
115+
extension InlineDocumentAsPayloadOutput: ClientRuntime.HttpResponseBinding {
116116
public init(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws {
117117
if let data = try await httpResponse.body.readData(), let responseDecoder = decoder {
118118
let output: ClientRuntime.Document = try responseDecoder.decode(responseBody: data)
@@ -127,10 +127,10 @@ extension InlineDocumentAsPayloadOutputResponse: ClientRuntime.HttpResponseBindi
127127
}
128128
@Test
129129
fun `default fooMap to an empty map if keysForFooMap is empty`() {
130-
val contents = getModelFileContents("example", "HttpPrefixHeadersOutputResponse+HttpResponseBinding.swift", newTestContext.manifest)
130+
val contents = getModelFileContents("example", "HttpPrefixHeadersOutput+HttpResponseBinding.swift", newTestContext.manifest)
131131
val expectedContents =
132132
"""
133-
extension HttpPrefixHeadersOutputResponse: ClientRuntime.HttpResponseBinding {
133+
extension HttpPrefixHeadersOutput: ClientRuntime.HttpResponseBinding {
134134
public init(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws {
135135
if let fooHeaderValue = httpResponse.headers.value(for: "X-Foo") {
136136
self.foo = fooHeaderValue

smithy-swift-codegen/src/test/kotlin/HttpBodyMiddlewareTests.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class HttpBodyMiddlewareTests {
3737
3838
public func handle<H>(context: Context,
3939
input: ClientRuntime.SerializeStepInput<ExplicitStringInput>,
40-
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitStringOutputResponse>
40+
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitStringOutput>
4141
where H: Handler,
4242
Self.MInput == H.Input,
4343
Self.MOutput == H.Output,
@@ -52,7 +52,7 @@ class HttpBodyMiddlewareTests {
5252
}
5353
5454
public typealias MInput = ClientRuntime.SerializeStepInput<ExplicitStringInput>
55-
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitStringOutputResponse>
55+
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitStringOutput>
5656
public typealias Context = ClientRuntime.HttpContext
5757
}
5858
""".trimIndent()
@@ -72,7 +72,7 @@ class HttpBodyMiddlewareTests {
7272
7373
public func handle<H>(context: Context,
7474
input: ClientRuntime.SerializeStepInput<ExplicitBlobInput>,
75-
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitBlobOutputResponse>
75+
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitBlobOutput>
7676
where H: Handler,
7777
Self.MInput == H.Input,
7878
Self.MOutput == H.Output,
@@ -87,7 +87,7 @@ class HttpBodyMiddlewareTests {
8787
}
8888
8989
public typealias MInput = ClientRuntime.SerializeStepInput<ExplicitBlobInput>
90-
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitBlobOutputResponse>
90+
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitBlobOutput>
9191
public typealias Context = ClientRuntime.HttpContext
9292
}
9393
""".trimIndent()
@@ -107,7 +107,7 @@ class HttpBodyMiddlewareTests {
107107
108108
public func handle<H>(context: Context,
109109
input: ClientRuntime.SerializeStepInput<ExplicitBlobStreamInput>,
110-
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitBlobStreamOutputResponse>
110+
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitBlobStreamOutput>
111111
where H: Handler,
112112
Self.MInput == H.Input,
113113
Self.MOutput == H.Output,
@@ -121,7 +121,7 @@ class HttpBodyMiddlewareTests {
121121
}
122122
123123
public typealias MInput = ClientRuntime.SerializeStepInput<ExplicitBlobStreamInput>
124-
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitBlobStreamOutputResponse>
124+
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitBlobStreamOutput>
125125
public typealias Context = ClientRuntime.HttpContext
126126
}
127127
""".trimIndent()
@@ -141,7 +141,7 @@ class HttpBodyMiddlewareTests {
141141
142142
public func handle<H>(context: Context,
143143
input: ClientRuntime.SerializeStepInput<ExplicitStructInput>,
144-
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitStructOutputResponse>
144+
next: H) async throws -> ClientRuntime.OperationOutput<ExplicitStructOutput>
145145
where H: Handler,
146146
Self.MInput == H.Input,
147147
Self.MOutput == H.Output,
@@ -168,7 +168,7 @@ class HttpBodyMiddlewareTests {
168168
}
169169
170170
public typealias MInput = ClientRuntime.SerializeStepInput<ExplicitStructInput>
171-
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitStructOutputResponse>
171+
public typealias MOutput = ClientRuntime.OperationOutput<ExplicitStructOutput>
172172
public typealias Context = ClientRuntime.HttpContext
173173
}
174174
""".trimIndent()

smithy-swift-codegen/src/test/kotlin/HttpProtocolClientGeneratorTests.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class HttpProtocolClientGeneratorTests {
111111
///
112112
/// - Parameter AllocateWidgetInput : [no documentation found]
113113
///
114-
/// - Returns: `AllocateWidgetOutputResponse` : [no documentation found]
115-
public func allocateWidget(input: AllocateWidgetInput) async throws -> AllocateWidgetOutputResponse
114+
/// - Returns: `AllocateWidgetOutput` : [no documentation found]
115+
public func allocateWidget(input: AllocateWidgetInput) async throws -> AllocateWidgetOutput
116116
{
117117
let context = ClientRuntime.HttpContextBuilder()
118118
.withEncoder(value: encoder)
@@ -124,23 +124,23 @@ class HttpProtocolClientGeneratorTests {
124124
.withLogger(value: config.logger)
125125
.withPartitionID(value: config.partitionID)
126126
.build()
127-
var operation = ClientRuntime.OperationStack<AllocateWidgetInput, AllocateWidgetOutputResponse, AllocateWidgetOutputError>(id: "allocateWidget")
128-
operation.initializeStep.intercept(position: .after, id: "IdempotencyTokenMiddleware") { (context, input, next) -> ClientRuntime.OperationOutput<AllocateWidgetOutputResponse> in
127+
var operation = ClientRuntime.OperationStack<AllocateWidgetInput, AllocateWidgetOutput, AllocateWidgetOutputError>(id: "allocateWidget")
128+
operation.initializeStep.intercept(position: .after, id: "IdempotencyTokenMiddleware") { (context, input, next) -> ClientRuntime.OperationOutput<AllocateWidgetOutput> in
129129
let idempotencyTokenGenerator = context.getIdempotencyTokenGenerator()
130130
var copiedInput = input
131131
if input.clientToken == nil {
132132
copiedInput.clientToken = idempotencyTokenGenerator.generateToken()
133133
}
134134
return try await next.handle(context: context, input: copiedInput)
135135
}
136-
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware<AllocateWidgetInput, AllocateWidgetOutputResponse, AllocateWidgetOutputError>())
137-
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware<AllocateWidgetInput, AllocateWidgetOutputResponse>())
138-
operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware<AllocateWidgetInput, AllocateWidgetOutputResponse>(contentType: "application/json"))
139-
operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware<AllocateWidgetInput, AllocateWidgetOutputResponse>(xmlName: "AllocateWidgetInput"))
136+
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware<AllocateWidgetInput, AllocateWidgetOutput, AllocateWidgetOutputError>())
137+
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware<AllocateWidgetInput, AllocateWidgetOutput>())
138+
operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware<AllocateWidgetInput, AllocateWidgetOutput>(contentType: "application/json"))
139+
operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware<AllocateWidgetInput, AllocateWidgetOutput>(xmlName: "AllocateWidgetInput"))
140140
operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware())
141-
operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware<ClientRuntime.DefaultRetryStrategy, ClientRuntime.DefaultRetryErrorInfoProvider, AllocateWidgetOutputResponse, AllocateWidgetOutputError>(options: config.retryStrategyOptions))
142-
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware<AllocateWidgetOutputResponse, AllocateWidgetOutputError>())
143-
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware<AllocateWidgetOutputResponse, AllocateWidgetOutputError>(clientLogMode: config.clientLogMode))
141+
operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware<ClientRuntime.DefaultRetryStrategy, ClientRuntime.DefaultRetryErrorInfoProvider, AllocateWidgetOutput, AllocateWidgetOutputError>(options: config.retryStrategyOptions))
142+
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware<AllocateWidgetOutput, AllocateWidgetOutputError>())
143+
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware<AllocateWidgetOutput, AllocateWidgetOutputError>(clientLogMode: config.clientLogMode))
144144
let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler())
145145
return result
146146
}

0 commit comments

Comments
 (0)