The smithy.api#Unit type can only be targeted by operation inputs/outputs or as a member of union shape. Inputs and outputs always get type defined even if the operation targeted unit (this is in part because unit support came later but also so that if a service wants to add members to a request/response they can do so in a backwards compatible way).
union Foo {
stringType: String,
unitType: Unit
}
Currently we seem to be generating a backing structure for union types
sealed class Foo {
class StringType(val value: String): Foo()
class UnitType(val value: Unit): Foo()
}
class Unit { ... }
We most likely just want to generate a variant with no members, e.g.:
sealed class Foo {
class StringType(val value: String): Foo()
object UnitType: Foo()
}
Want to confirm that there are no current unions targeting a unit member before changing this.
confirmed no current unions target a unit member: smithy select --allow-unknown-traits --selector "union > member > [trait|smithy.api#unitType]" ./*.json
The smithy.api#Unit type can only be targeted by operation inputs/outputs or as a member of union shape. Inputs and outputs always get type defined even if the operation targeted
unit
(this is in part becauseunit
support came later but also so that if a service wants to add members to a request/response they can do so in a backwards compatible way).Currently we seem to be generating a backing structure for union types
We most likely just want to generate a variant with no members, e.g.:
Want to confirm that there are no current unions targeting a unit member before changing this.