Skip to content

Commit 5867dfa

Browse files
authored
fix: AttributeKey code generation (#1001)
Fix compiler not able to infer type information from generated endpoint attributes.
1 parent f01d24a commit 5867dfa

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/DefaultEndpointProviderGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class DefaultEndpointProviderGenerator(
180180

181181
// otherwise, we just traverse the value like any other rules expression, object values will
182182
// be rendered as Documents
183-
writeInline("#T(#S) to ", RuntimeTypes.Core.Collections.AttributeKey, kStr)
183+
writeInline("#S to ", kStr)
184184
renderExpression(v)
185185
ensureNewline()
186186
}

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/DefaultEndpointProviderTestGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class DefaultEndpointProviderTestGenerator(
126126
return@forEach
127127
}
128128

129-
writeInline("#T(#S) to ", RuntimeTypes.Core.Collections.AttributeKey, k)
129+
writeInline("#S to ", k)
130130
renderExpression(Expression.fromNode(v))
131131
ensureNewline()
132132
}

codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/DefaultEndpointProviderGeneratorTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ class DefaultEndpointProviderGeneratorTest {
217217
append("fooheader", "barheader")
218218
},
219219
attributes = attributesOf {
220-
AttributeKey("foo") to "bar"
221-
AttributeKey("fooInt") to 7
222-
AttributeKey("fooBoolean") to true
223-
AttributeKey("fooObject") to buildDocument {
220+
"foo" to "bar"
221+
"fooInt" to 7
222+
"fooBoolean" to true
223+
"fooObject" to buildDocument {
224224
"fooObjectFoo" to "bar"
225225
}
226-
AttributeKey("fooArray") to listOf(
226+
"fooArray" to listOf(
227227
"\"fooArrayBar\"",
228228
)
229229
},

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/collections/Attributes.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package aws.smithy.kotlin.runtime.collections
88
/**
99
* Specifies a key for an attribute
1010
*
11-
* @param T is the type of the vale stored in the attribute
11+
* @param T is the type of the value stored in the attribute
1212
* @param name the name of the attribute (for diagnostics)
1313
*/
1414
public data class AttributeKey<T>(public val name: String) {

0 commit comments

Comments
 (0)