Skip to content

Commit

Permalink
feat: default trait implementation (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis authored Jun 16, 2023
1 parent 1ff0f4b commit 47baedf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
import software.amazon.smithy.kotlin.codegen.integration.SectionWriterBinding
import software.amazon.smithy.kotlin.codegen.lang.KotlinTypes
import software.amazon.smithy.kotlin.codegen.model.asNullable
import software.amazon.smithy.kotlin.codegen.model.boxed
import software.amazon.smithy.kotlin.codegen.model.knowledge.AwsSignatureVersion4
import software.amazon.smithy.kotlin.codegen.model.nullable
import software.amazon.smithy.kotlin.codegen.rendering.*
import software.amazon.smithy.kotlin.codegen.rendering.util.ConfigProperty
import software.amazon.smithy.kotlin.codegen.rendering.util.ConfigPropertyType
Expand All @@ -22,7 +22,7 @@ class AwsServiceConfigIntegration : KotlinIntegration {
companion object {
val RegionProp: ConfigProperty = ConfigProperty {
name = "region"
symbol = KotlinTypes.String.toBuilder().boxed().build()
symbol = KotlinTypes.String.toBuilder().nullable().build()
baseClass = AwsRuntimeTypes.Core.Client.AwsSdkClientConfig
useNestedBuilderBaseClass()
documentation = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class EventStreamParserGenerator(
else -> throw CodegenException("unsupported eventHeader shape: member=$hdrBinding; targetShape=$target")
}

val defaultValuePostfix = if (targetSymbol.isNotBoxed && targetSymbol.defaultValue() != null) {
val defaultValuePostfix = if (targetSymbol.isNotNullable && targetSymbol.defaultValue() != null) {
" ?: ${targetSymbol.defaultValue()}"
} else {
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BoxServicesTest {
structure Other {}
integer NotBoxedField
""".prependNamespaceAndService(operations = listOf("Foo")).toSmithyModel()
""".prependNamespaceAndService(version = "1", operations = listOf("Foo")).toSmithyModel()

val ctx = model.newTestContext()
val transformed = BoxServices().preprocessModel(model, ctx.generationCtx.settings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class RemoveEventStreamOperationsTest {
input: BlobInput
}
structure BlobInput {
@required
blob: StreamingBlob
}
@streaming
Expand Down

0 comments on commit 47baedf

Please sign in to comment.