-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix!: Remove mutating 'addInterceptor' methods from client config #901
Changes from all commits
6ffb9c6
0f29546
f2a66b1
ee3eb9e
f0872ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,8 @@ class SwiftWriter( | |
|
||
fun addImport(symbol: Symbol) { | ||
symbol.references.forEach { addImport(it.symbol) } | ||
val additionalImports = symbol.getProperty("additionalImports").getOrElse { emptyList<Symbol>() } as List<Symbol> | ||
additionalImports.forEach { addImport(it) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additional imports were moved from the bottom to the top of this method because the early-exit on line 111 below causes additional imports to not be added when the enclosing type of the symbol is a Swift built-in. (This was preventing the needed imports from being rendered for the symbols |
||
if (symbol.isBuiltIn || symbol.isServiceNestedNamespace || symbol.namespace.isEmpty()) return | ||
val spiNames = symbol.getProperty("spiNames").getOrElse { emptyList<String>() } as List<String> | ||
val decl = symbol.getProperty("decl").getOrNull()?.toString() | ||
|
@@ -127,8 +129,6 @@ class SwiftWriter( | |
addImport(symbol.namespace, internalSPINames = spiNames) | ||
} | ||
symbol.dependencies.forEach { addDependency(it) } | ||
val additionalImports = symbol.getProperty("additionalImports").getOrElse { emptyList<Symbol>() } as List<Symbol> | ||
additionalImports.forEach { addImport(it) } | ||
} | ||
|
||
fun addImport( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ package software.amazon.smithy.swift.codegen.config | |
import software.amazon.smithy.codegen.core.Symbol | ||
import software.amazon.smithy.swift.codegen.Dependency | ||
import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator | ||
import software.amazon.smithy.swift.codegen.lang.Function | ||
import software.amazon.smithy.swift.codegen.model.buildSymbol | ||
|
||
/** | ||
|
@@ -22,11 +21,6 @@ interface ClientConfiguration { | |
|
||
fun getProperties(ctx: ProtocolGenerator.GenerationContext): Set<ConfigProperty> | ||
|
||
/** | ||
* The methods to render in the generated client configuration | ||
*/ | ||
fun getMethods(ctx: ProtocolGenerator.GenerationContext): Set<Function> = setOf() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was only used for the add interceptor methods, so it is now removed. |
||
|
||
companion object { | ||
fun runtimeSymbol( | ||
name: String, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ package software.amazon.smithy.swift.codegen.config | |
import software.amazon.smithy.codegen.core.Symbol | ||
import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator | ||
import software.amazon.smithy.swift.codegen.lang.AccessModifier | ||
import software.amazon.smithy.swift.codegen.lang.Function | ||
import software.amazon.smithy.swift.codegen.lang.FunctionParameter | ||
import software.amazon.smithy.swift.codegen.model.toOptional | ||
import software.amazon.smithy.swift.codegen.swiftmodules.ClientRuntimeTypes | ||
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyRetriesAPITypes | ||
|
@@ -47,14 +45,4 @@ class DefaultClientConfiguration : ClientConfiguration { | |
accessModifier = AccessModifier.PublicPrivateSet | ||
) | ||
) | ||
|
||
override fun getMethods(ctx: ProtocolGenerator.GenerationContext): Set<Function> = setOf( | ||
Function( | ||
name = "addInterceptorProvider", | ||
renderBody = { writer -> writer.write("self.interceptorProviders.append(provider)") }, | ||
parameters = listOf( | ||
FunctionParameter.NoLabel("provider", ClientRuntimeTypes.Core.InterceptorProvider) | ||
), | ||
) | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codegen of the add methods into client config is removed here & in the file below. |
||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The add methods are removed from this & the following default config protocols