diff --git a/modules/aws-http4s/src/smithy4s/aws/query/AwsSchemaVisitorAwsQueryCodec.scala b/modules/aws-http4s/src/smithy4s/aws/query/AwsSchemaVisitorAwsQueryCodec.scala
index 3e331e235..da8f77398 100644
--- a/modules/aws-http4s/src/smithy4s/aws/query/AwsSchemaVisitorAwsQueryCodec.scala
+++ b/modules/aws-http4s/src/smithy4s/aws/query/AwsSchemaVisitorAwsQueryCodec.scala
@@ -136,8 +136,8 @@ private[aws] class AwsSchemaVisitorAwsQueryCodec(
def encode[A](u: U, alt: Alt[U, A]): FormData = {
val key = getKey(alt.hints, alt.label)
- dispatch
- .projector(alt)(u)
+ alt.project
+ .lift(u)
.fold(FormData.Empty.widen)(a => compile(alt.schema)(a))
.prepend(key)
}
diff --git a/modules/aws-http4s/test/src/smithy4s/aws/query/AwsQueryCodecSpec.scala b/modules/aws-http4s/test/src/smithy4s/aws/query/AwsQueryCodecSpec.scala
index 51e1caf24..becbed4b8 100644
--- a/modules/aws-http4s/test/src/smithy4s/aws/query/AwsQueryCodecSpec.scala
+++ b/modules/aws-http4s/test/src/smithy4s/aws/query/AwsQueryCodecSpec.scala
@@ -232,14 +232,7 @@ object AwsQueryCodecSpec extends SimpleIOSuite {
test("union") {
type Foo = Either[Int, String]
- implicit val schema: Schema[Foo] = {
- val left = int.oneOf[Foo]("left", Left(_))
- val right = string.oneOf[Foo]("right", Right(_))
- union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
- }
+ implicit val schema: Schema[Foo] = Schema.either(int, string)
val expectedLeft = "left=1"
val expectedRight = "right=hello"
checkContent[Foo](expectedLeft, Left(1)) |+|
@@ -248,14 +241,10 @@ object AwsQueryCodecSpec extends SimpleIOSuite {
test("union: custom names") {
type Foo = Either[Int, String]
- implicit val schema: Schema[Foo] = {
- val left = int.oneOf[Foo]("left", Left(_)).addHints(XmlName("foo"))
- val right = string.oneOf[Foo]("right", Right(_)).addHints(XmlName("bar"))
- union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
- }
+ implicit val schema: Schema[Foo] = Schema.either(
+ int.addMemberHints(XmlName("foo")),
+ string.addMemberHints(XmlName("bar"))
+ )
val expectedLeft = "foo=1"
val expectedRight = "bar=hello".stripMargin
checkContent[Foo](expectedLeft, Left(1)) |+|
diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DynamoDB.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DynamoDB.scala
index c14906c1d..d7342d070 100644
--- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DynamoDB.scala
+++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DynamoDB.scala
@@ -76,12 +76,14 @@ object DynamoDBGen extends Service.Mixin[DynamoDBGen, DynamoDBOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[DynamoDBOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[DynamoDBOperation, _, _, _, _, _]] = Vector(
DynamoDBOperation.DescribeEndpoints,
DynamoDBOperation.ListTables,
)
- def endpoint[I, E, O, SI, SO](op: DynamoDBOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: DynamoDBOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: DynamoDBOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: DynamoDBOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends DynamoDBOperation.Transformed[DynamoDBOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: DynamoDBGen[DynamoDBOperation] = DynamoDBOperation.reified
@@ -95,7 +97,9 @@ object DynamoDBGen extends Service.Mixin[DynamoDBGen, DynamoDBOperation] {
sealed trait DynamoDBOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: DynamoDBGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, smithy4s.Endpoint[DynamoDBOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: smithy4s.Endpoint[DynamoDBOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object DynamoDBOperation {
@@ -114,7 +118,8 @@ object DynamoDBOperation {
}
final case class DescribeEndpoints(input: DescribeEndpointsRequest) extends DynamoDBOperation[DescribeEndpointsRequest, Nothing, DescribeEndpointsResponse, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DynamoDBGen[F]): F[DescribeEndpointsRequest, Nothing, DescribeEndpointsResponse, Nothing, Nothing] = impl.describeEndpoints()
- def endpoint: (DescribeEndpointsRequest, smithy4s.Endpoint[DynamoDBOperation,DescribeEndpointsRequest, Nothing, DescribeEndpointsResponse, Nothing, Nothing]) = (input, DescribeEndpoints)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[DynamoDBOperation,DescribeEndpointsRequest, Nothing, DescribeEndpointsResponse, Nothing, Nothing] = DescribeEndpoints
}
object DescribeEndpoints extends smithy4s.Endpoint[DynamoDBOperation,DescribeEndpointsRequest, Nothing, DescribeEndpointsResponse, Nothing, Nothing] {
val id: ShapeId = ShapeId("com.amazonaws.dynamodb", "DescribeEndpoints")
@@ -130,7 +135,8 @@ object DynamoDBOperation {
}
final case class ListTables(input: ListTablesInput) extends DynamoDBOperation[ListTablesInput, DynamoDBOperation.ListTablesError, ListTablesOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DynamoDBGen[F]): F[ListTablesInput, DynamoDBOperation.ListTablesError, ListTablesOutput, Nothing, Nothing] = impl.listTables(input.exclusiveStartTableName, input.limit)
- def endpoint: (ListTablesInput, smithy4s.Endpoint[DynamoDBOperation,ListTablesInput, DynamoDBOperation.ListTablesError, ListTablesOutput, Nothing, Nothing]) = (input, ListTables)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[DynamoDBOperation,ListTablesInput, DynamoDBOperation.ListTablesError, ListTablesOutput, Nothing, Nothing] = ListTables
}
object ListTables extends smithy4s.Endpoint[DynamoDBOperation,ListTablesInput, DynamoDBOperation.ListTablesError, ListTablesOutput, Nothing, Nothing] with Errorable[ListTablesError] {
val id: ShapeId = ShapeId("com.amazonaws.dynamodb", "ListTables")
@@ -158,15 +164,16 @@ object DynamoDBOperation {
}
sealed trait ListTablesError extends scala.Product with scala.Serializable {
@inline final def widen: ListTablesError = this
+ def _ordinal: Int
}
object ListTablesError extends ShapeTag.Companion[ListTablesError] {
val id: ShapeId = ShapeId("com.amazonaws.dynamodb", "ListTablesError")
val hints: Hints = Hints.empty
- final case class InternalServerErrorCase(internalServerError: InternalServerError) extends ListTablesError
+ final case class InternalServerErrorCase(internalServerError: InternalServerError) extends ListTablesError { final def _ordinal: Int = 0 }
def internalServerError(internalServerError:InternalServerError): ListTablesError = InternalServerErrorCase(internalServerError)
- final case class InvalidEndpointExceptionCase(invalidEndpointException: InvalidEndpointException) extends ListTablesError
+ final case class InvalidEndpointExceptionCase(invalidEndpointException: InvalidEndpointException) extends ListTablesError { final def _ordinal: Int = 1 }
def invalidEndpointException(invalidEndpointException:InvalidEndpointException): ListTablesError = InvalidEndpointExceptionCase(invalidEndpointException)
object InternalServerErrorCase {
@@ -184,8 +191,7 @@ object DynamoDBOperation {
InternalServerErrorCase.alt,
InvalidEndpointExceptionCase.alt,
){
- case c: InternalServerErrorCase => InternalServerErrorCase.alt(c)
- case c: InvalidEndpointExceptionCase => InvalidEndpointExceptionCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/BenchmarkService.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/BenchmarkService.scala
index 16a4e2876..bf58c5f83 100644
--- a/modules/bootstrapped/src/generated/smithy4s/benchmark/BenchmarkService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/BenchmarkService.scala
@@ -34,12 +34,14 @@ object BenchmarkServiceGen extends Service.Mixin[BenchmarkServiceGen, BenchmarkS
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[BenchmarkServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[BenchmarkServiceOperation, _, _, _, _, _]] = Vector(
BenchmarkServiceOperation.CreateObject,
BenchmarkServiceOperation.SendString,
)
- def endpoint[I, E, O, SI, SO](op: BenchmarkServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: BenchmarkServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: BenchmarkServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: BenchmarkServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends BenchmarkServiceOperation.Transformed[BenchmarkServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: BenchmarkServiceGen[BenchmarkServiceOperation] = BenchmarkServiceOperation.reified
@@ -51,7 +53,9 @@ object BenchmarkServiceGen extends Service.Mixin[BenchmarkServiceGen, BenchmarkS
sealed trait BenchmarkServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: BenchmarkServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[BenchmarkServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[BenchmarkServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object BenchmarkServiceOperation {
@@ -70,7 +74,8 @@ object BenchmarkServiceOperation {
}
final case class CreateObject(input: CreateObjectInput) extends BenchmarkServiceOperation[CreateObjectInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: BenchmarkServiceGen[F]): F[CreateObjectInput, Nothing, Unit, Nothing, Nothing] = impl.createObject(input.key, input.bucketName, input.payload)
- def endpoint: (CreateObjectInput, smithy4s.Endpoint[BenchmarkServiceOperation,CreateObjectInput, Nothing, Unit, Nothing, Nothing]) = (input, CreateObject)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[BenchmarkServiceOperation,CreateObjectInput, Nothing, Unit, Nothing, Nothing] = CreateObject
}
object CreateObject extends smithy4s.Endpoint[BenchmarkServiceOperation,CreateObjectInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.benchmark", "CreateObject")
@@ -86,7 +91,8 @@ object BenchmarkServiceOperation {
}
final case class SendString(input: SendStringInput) extends BenchmarkServiceOperation[SendStringInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: BenchmarkServiceGen[F]): F[SendStringInput, Nothing, Unit, Nothing, Nothing] = impl.sendString(input.key, input.bucketName, input.body)
- def endpoint: (SendStringInput, smithy4s.Endpoint[BenchmarkServiceOperation,SendStringInput, Nothing, Unit, Nothing, Nothing]) = (input, SendString)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[BenchmarkServiceOperation,SendStringInput, Nothing, Unit, Nothing, Nothing] = SendString
}
object SendString extends smithy4s.Endpoint[BenchmarkServiceOperation,SendStringInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.benchmark", "SendString")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/BrandService.scala b/modules/bootstrapped/src/generated/smithy4s/example/BrandService.scala
index 2d62c8665..092c3f6c6 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/BrandService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/BrandService.scala
@@ -33,11 +33,13 @@ object BrandServiceGen extends Service.Mixin[BrandServiceGen, BrandServiceOperat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[BrandServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[BrandServiceOperation, _, _, _, _, _]] = Vector(
BrandServiceOperation.AddBrands,
)
- def endpoint[I, E, O, SI, SO](op: BrandServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: BrandServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: BrandServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: BrandServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends BrandServiceOperation.Transformed[BrandServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: BrandServiceGen[BrandServiceOperation] = BrandServiceOperation.reified
@@ -49,7 +51,9 @@ object BrandServiceGen extends Service.Mixin[BrandServiceGen, BrandServiceOperat
sealed trait BrandServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: BrandServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[BrandServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[BrandServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object BrandServiceOperation {
@@ -66,7 +70,8 @@ object BrandServiceOperation {
}
final case class AddBrands(input: AddBrandsInput) extends BrandServiceOperation[AddBrandsInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: BrandServiceGen[F]): F[AddBrandsInput, Nothing, Unit, Nothing, Nothing] = impl.addBrands(input.brands)
- def endpoint: (AddBrandsInput, smithy4s.Endpoint[BrandServiceOperation,AddBrandsInput, Nothing, Unit, Nothing, Nothing]) = (input, AddBrands)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[BrandServiceOperation,AddBrandsInput, Nothing, Unit, Nothing, Nothing] = AddBrands
}
object AddBrands extends smithy4s.Endpoint[BrandServiceOperation,AddBrandsInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "AddBrands")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked.scala b/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked.scala
index 7a7017865..2174f084e 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked.scala
@@ -10,15 +10,16 @@ import smithy4s.schema.Schema.union
sealed trait CheckedOrUnchecked extends scala.Product with scala.Serializable {
@inline final def widen: CheckedOrUnchecked = this
+ def _ordinal: Int
}
object CheckedOrUnchecked extends ShapeTag.Companion[CheckedOrUnchecked] {
val id: ShapeId = ShapeId("smithy4s.example", "CheckedOrUnchecked")
val hints: Hints = Hints.empty
- final case class CheckedCase(checked: String) extends CheckedOrUnchecked
+ final case class CheckedCase(checked: String) extends CheckedOrUnchecked { final def _ordinal: Int = 0 }
def checked(checked:String): CheckedOrUnchecked = CheckedCase(checked)
- final case class RawCase(raw: String) extends CheckedOrUnchecked
+ final case class RawCase(raw: String) extends CheckedOrUnchecked { final def _ordinal: Int = 1 }
def raw(raw:String): CheckedOrUnchecked = RawCase(raw)
object CheckedCase {
@@ -36,7 +37,6 @@ object CheckedOrUnchecked extends ShapeTag.Companion[CheckedOrUnchecked] {
CheckedCase.alt,
RawCase.alt,
){
- case c: CheckedCase => CheckedCase.alt(c)
- case c: RawCase => RawCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked2.scala b/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked2.scala
index c6b752b11..b701bfc2a 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked2.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/CheckedOrUnchecked2.scala
@@ -10,6 +10,7 @@ import smithy4s.schema.Schema.union
sealed trait CheckedOrUnchecked2 extends scala.Product with scala.Serializable {
@inline final def widen: CheckedOrUnchecked2 = this
+ def _ordinal: Int
}
object CheckedOrUnchecked2 extends ShapeTag.Companion[CheckedOrUnchecked2] {
val id: ShapeId = ShapeId("smithy4s.example", "CheckedOrUnchecked2")
@@ -18,9 +19,9 @@ object CheckedOrUnchecked2 extends ShapeTag.Companion[CheckedOrUnchecked2] {
alloy.Untagged(),
)
- final case class CheckedCase(checked: String) extends CheckedOrUnchecked2
+ final case class CheckedCase(checked: String) extends CheckedOrUnchecked2 { final def _ordinal: Int = 0 }
def checked(checked:String): CheckedOrUnchecked2 = CheckedCase(checked)
- final case class RawCase(raw: String) extends CheckedOrUnchecked2
+ final case class RawCase(raw: String) extends CheckedOrUnchecked2 { final def _ordinal: Int = 1 }
def raw(raw:String): CheckedOrUnchecked2 = RawCase(raw)
object CheckedCase {
@@ -38,7 +39,6 @@ object CheckedOrUnchecked2 extends ShapeTag.Companion[CheckedOrUnchecked2] {
CheckedCase.alt,
RawCase.alt,
){
- case c: CheckedCase => CheckedCase.alt(c)
- case c: RawCase => RawCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedService.scala b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedService.scala
index d8b6771d9..c28b89e1a 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedService.scala
@@ -37,11 +37,13 @@ object DeprecatedServiceGen extends Service.Mixin[DeprecatedServiceGen, Deprecat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[DeprecatedServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[DeprecatedServiceOperation, _, _, _, _, _]] = Vector(
DeprecatedServiceOperation.DeprecatedOperation,
)
- def endpoint[I, E, O, SI, SO](op: DeprecatedServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: DeprecatedServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: DeprecatedServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: DeprecatedServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends DeprecatedServiceOperation.Transformed[DeprecatedServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: DeprecatedServiceGen[DeprecatedServiceOperation] = DeprecatedServiceOperation.reified
@@ -53,7 +55,9 @@ object DeprecatedServiceGen extends Service.Mixin[DeprecatedServiceGen, Deprecat
sealed trait DeprecatedServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: DeprecatedServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[DeprecatedServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[DeprecatedServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object DeprecatedServiceOperation {
@@ -70,7 +74,9 @@ object DeprecatedServiceOperation {
}
final case class DeprecatedOperation() extends DeprecatedServiceOperation[Unit, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DeprecatedServiceGen[F]): F[Unit, Nothing, Unit, Nothing, Nothing] = impl.deprecatedOperation()
- def endpoint: (Unit, smithy4s.Endpoint[DeprecatedServiceOperation,Unit, Nothing, Unit, Nothing, Nothing]) = ((), DeprecatedOperation)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[DeprecatedServiceOperation,Unit, Nothing, Unit, Nothing, Nothing] = DeprecatedOperation
}
object DeprecatedOperation extends smithy4s.Endpoint[DeprecatedServiceOperation,Unit, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "DeprecatedOperation")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala
index 95fe3a2a2..f0296c126 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala
@@ -12,6 +12,7 @@ import smithy4s.schema.Schema.union
@deprecated(message = "A compelling reason", since = "0.0.1")
sealed trait DeprecatedUnion extends scala.Product with scala.Serializable {
@inline final def widen: DeprecatedUnion = this
+ def _ordinal: Int
}
object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] {
val id: ShapeId = ShapeId("smithy4s.example", "DeprecatedUnion")
@@ -21,12 +22,14 @@ object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] {
)
@deprecated(message = "N/A", since = "N/A")
- final case class SCase(s: String) extends DeprecatedUnion
+ final case class SCase(s: String) extends DeprecatedUnion { final def _ordinal: Int = 0 }
def s(s:String): DeprecatedUnion = SCase(s)
- final case class S_V2Case(s_V2: String) extends DeprecatedUnion
+ final case class S_V2Case(s_V2: String) extends DeprecatedUnion { final def _ordinal: Int = 1 }
def s_V2(s_V2:String): DeprecatedUnion = S_V2Case(s_V2)
@deprecated(message = "N/A", since = "N/A")
- final case class DeprecatedUnionProductCase() extends DeprecatedUnion
+ final case class DeprecatedUnionProductCase() extends DeprecatedUnion {
+ def _ordinal: Int = 2
+ }
object DeprecatedUnionProductCase extends ShapeTag.Companion[DeprecatedUnionProductCase] {
val id: ShapeId = ShapeId("smithy4s.example", "DeprecatedUnionProductCase")
@@ -39,7 +42,9 @@ object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] {
val alt = schema.oneOf[DeprecatedUnion]("p")
}
@deprecated(message = "N/A", since = "N/A")
- final case class UnionProductCaseDeprecatedAtCallSite() extends DeprecatedUnion
+ final case class UnionProductCaseDeprecatedAtCallSite() extends DeprecatedUnion {
+ def _ordinal: Int = 3
+ }
object UnionProductCaseDeprecatedAtCallSite extends ShapeTag.Companion[UnionProductCaseDeprecatedAtCallSite] {
val id: ShapeId = ShapeId("smithy4s.example", "UnionProductCaseDeprecatedAtCallSite")
@@ -71,9 +76,6 @@ object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] {
DeprecatedUnionProductCase.alt,
UnionProductCaseDeprecatedAtCallSite.alt,
){
- case c: SCase => SCase.alt(c)
- case c: S_V2Case => S_V2Case.alt(c)
- case c: DeprecatedUnionProductCase => DeprecatedUnionProductCase.alt(c)
- case c: UnionProductCaseDeprecatedAtCallSite => UnionProductCaseDeprecatedAtCallSite.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DiscriminatedService.scala b/modules/bootstrapped/src/generated/smithy4s/example/DiscriminatedService.scala
index da203603f..24433ecf7 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/DiscriminatedService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/DiscriminatedService.scala
@@ -34,11 +34,13 @@ object DiscriminatedServiceGen extends Service.Mixin[DiscriminatedServiceGen, Di
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[DiscriminatedServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[DiscriminatedServiceOperation, _, _, _, _, _]] = Vector(
DiscriminatedServiceOperation.TestDiscriminated,
)
- def endpoint[I, E, O, SI, SO](op: DiscriminatedServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: DiscriminatedServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: DiscriminatedServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: DiscriminatedServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends DiscriminatedServiceOperation.Transformed[DiscriminatedServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: DiscriminatedServiceGen[DiscriminatedServiceOperation] = DiscriminatedServiceOperation.reified
@@ -50,7 +52,9 @@ object DiscriminatedServiceGen extends Service.Mixin[DiscriminatedServiceGen, Di
sealed trait DiscriminatedServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: DiscriminatedServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[DiscriminatedServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[DiscriminatedServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object DiscriminatedServiceOperation {
@@ -67,7 +71,8 @@ object DiscriminatedServiceOperation {
}
final case class TestDiscriminated(input: TestDiscriminatedInput) extends DiscriminatedServiceOperation[TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DiscriminatedServiceGen[F]): F[TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing] = impl.testDiscriminated(input.key)
- def endpoint: (TestDiscriminatedInput, smithy4s.Endpoint[DiscriminatedServiceOperation,TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing]) = (input, TestDiscriminated)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[DiscriminatedServiceOperation,TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing] = TestDiscriminated
}
object TestDiscriminated extends smithy4s.Endpoint[DiscriminatedServiceOperation,TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "TestDiscriminated")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DummyService.scala b/modules/bootstrapped/src/generated/smithy4s/example/DummyService.scala
index 448279120..5fa3aa552 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/DummyService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/DummyService.scala
@@ -40,12 +40,14 @@ object DummyServiceGen extends Service.Mixin[DummyServiceGen, DummyServiceOperat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[DummyServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[DummyServiceOperation, _, _, _, _, _]] = Vector(
DummyServiceOperation.Dummy,
DummyServiceOperation.DummyPath,
)
- def endpoint[I, E, O, SI, SO](op: DummyServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: DummyServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: DummyServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: DummyServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends DummyServiceOperation.Transformed[DummyServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: DummyServiceGen[DummyServiceOperation] = DummyServiceOperation.reified
@@ -57,7 +59,9 @@ object DummyServiceGen extends Service.Mixin[DummyServiceGen, DummyServiceOperat
sealed trait DummyServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: DummyServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[DummyServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[DummyServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object DummyServiceOperation {
@@ -76,7 +80,8 @@ object DummyServiceOperation {
}
final case class Dummy(input: Queries) extends DummyServiceOperation[Queries, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DummyServiceGen[F]): F[Queries, Nothing, Unit, Nothing, Nothing] = impl.dummy(input.str, input.int, input.ts1, input.ts2, input.ts3, input.ts4, input.b, input.sl, input.ie, input.slm)
- def endpoint: (Queries, smithy4s.Endpoint[DummyServiceOperation,Queries, Nothing, Unit, Nothing, Nothing]) = (input, Dummy)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[DummyServiceOperation,Queries, Nothing, Unit, Nothing, Nothing] = Dummy
}
object Dummy extends smithy4s.Endpoint[DummyServiceOperation,Queries, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "Dummy")
@@ -93,7 +98,8 @@ object DummyServiceOperation {
}
final case class DummyPath(input: PathParams) extends DummyServiceOperation[PathParams, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: DummyServiceGen[F]): F[PathParams, Nothing, Unit, Nothing, Nothing] = impl.dummyPath(input.str, input.int, input.ts1, input.ts2, input.ts3, input.ts4, input.b, input.ie)
- def endpoint: (PathParams, smithy4s.Endpoint[DummyServiceOperation,PathParams, Nothing, Unit, Nothing, Nothing]) = (input, DummyPath)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[DummyServiceOperation,PathParams, Nothing, Unit, Nothing, Nothing] = DummyPath
}
object DummyPath extends smithy4s.Endpoint[DummyServiceOperation,PathParams, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "DummyPath")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EmptyService.scala b/modules/bootstrapped/src/generated/smithy4s/example/EmptyService.scala
index 655c2bf91..a2c14736b 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/EmptyService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/EmptyService.scala
@@ -29,9 +29,11 @@ object EmptyServiceGen extends Service.Mixin[EmptyServiceGen, EmptyServiceOperat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[EmptyServiceOperation, _, _, _, _, _]] = List()
+ val endpoints: Vector[smithy4s.Endpoint[EmptyServiceOperation, _, _, _, _, _]] = Vector()
- def endpoint[I, E, O, SI, SO](op: EmptyServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: EmptyServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: EmptyServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: EmptyServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends EmptyServiceOperation.Transformed[EmptyServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: EmptyServiceGen[EmptyServiceOperation] = EmptyServiceOperation.reified
@@ -43,7 +45,9 @@ object EmptyServiceGen extends Service.Mixin[EmptyServiceGen, EmptyServiceOperat
sealed trait EmptyServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: EmptyServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[EmptyServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[EmptyServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object EmptyServiceOperation {
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingService.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingService.scala
index 418db25a8..f570437a8 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingService.scala
@@ -37,11 +37,13 @@ object ErrorHandlingServiceGen extends Service.Mixin[ErrorHandlingServiceGen, Er
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[ErrorHandlingServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[ErrorHandlingServiceOperation, _, _, _, _, _]] = Vector(
ErrorHandlingServiceOperation.ErrorHandlingOperation,
)
- def endpoint[I, E, O, SI, SO](op: ErrorHandlingServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ErrorHandlingServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ErrorHandlingServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ErrorHandlingServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ErrorHandlingServiceOperation.Transformed[ErrorHandlingServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ErrorHandlingServiceGen[ErrorHandlingServiceOperation] = ErrorHandlingServiceOperation.reified
@@ -55,7 +57,9 @@ object ErrorHandlingServiceGen extends Service.Mixin[ErrorHandlingServiceGen, Er
sealed trait ErrorHandlingServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ErrorHandlingServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ErrorHandlingServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ErrorHandlingServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ErrorHandlingServiceOperation {
@@ -72,7 +76,8 @@ object ErrorHandlingServiceOperation {
}
final case class ErrorHandlingOperation(input: ErrorHandlingOperationInput) extends ErrorHandlingServiceOperation[ErrorHandlingOperationInput, ErrorHandlingServiceOperation.ErrorHandlingOperationError, ErrorHandlingOperationOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ErrorHandlingServiceGen[F]): F[ErrorHandlingOperationInput, ErrorHandlingServiceOperation.ErrorHandlingOperationError, ErrorHandlingOperationOutput, Nothing, Nothing] = impl.errorHandlingOperation(input.in)
- def endpoint: (ErrorHandlingOperationInput, smithy4s.Endpoint[ErrorHandlingServiceOperation,ErrorHandlingOperationInput, ErrorHandlingServiceOperation.ErrorHandlingOperationError, ErrorHandlingOperationOutput, Nothing, Nothing]) = (input, ErrorHandlingOperation)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[ErrorHandlingServiceOperation,ErrorHandlingOperationInput, ErrorHandlingServiceOperation.ErrorHandlingOperationError, ErrorHandlingOperationOutput, Nothing, Nothing] = ErrorHandlingOperation
}
object ErrorHandlingOperation extends smithy4s.Endpoint[ErrorHandlingServiceOperation,ErrorHandlingOperationInput, ErrorHandlingServiceOperation.ErrorHandlingOperationError, ErrorHandlingOperationOutput, Nothing, Nothing] with Errorable[ErrorHandlingOperationError] {
val id: ShapeId = ShapeId("smithy4s.example", "ErrorHandlingOperation")
@@ -100,19 +105,20 @@ object ErrorHandlingServiceOperation {
}
sealed trait ErrorHandlingOperationError extends scala.Product with scala.Serializable {
@inline final def widen: ErrorHandlingOperationError = this
+ def _ordinal: Int
}
object ErrorHandlingOperationError extends ShapeTag.Companion[ErrorHandlingOperationError] {
val id: ShapeId = ShapeId("smithy4s.example", "ErrorHandlingOperationError")
val hints: Hints = Hints.empty
- final case class EHFallbackClientErrorCase(eHFallbackClientError: EHFallbackClientError) extends ErrorHandlingOperationError
+ final case class EHFallbackClientErrorCase(eHFallbackClientError: EHFallbackClientError) extends ErrorHandlingOperationError { final def _ordinal: Int = 0 }
def eHFallbackClientError(eHFallbackClientError:EHFallbackClientError): ErrorHandlingOperationError = EHFallbackClientErrorCase(eHFallbackClientError)
- final case class EHServiceUnavailableCase(eHServiceUnavailable: EHServiceUnavailable) extends ErrorHandlingOperationError
+ final case class EHServiceUnavailableCase(eHServiceUnavailable: EHServiceUnavailable) extends ErrorHandlingOperationError { final def _ordinal: Int = 1 }
def eHServiceUnavailable(eHServiceUnavailable:EHServiceUnavailable): ErrorHandlingOperationError = EHServiceUnavailableCase(eHServiceUnavailable)
- final case class EHNotFoundCase(eHNotFound: EHNotFound) extends ErrorHandlingOperationError
+ final case class EHNotFoundCase(eHNotFound: EHNotFound) extends ErrorHandlingOperationError { final def _ordinal: Int = 2 }
def eHNotFound(eHNotFound:EHNotFound): ErrorHandlingOperationError = EHNotFoundCase(eHNotFound)
- final case class EHFallbackServerErrorCase(eHFallbackServerError: EHFallbackServerError) extends ErrorHandlingOperationError
+ final case class EHFallbackServerErrorCase(eHFallbackServerError: EHFallbackServerError) extends ErrorHandlingOperationError { final def _ordinal: Int = 3 }
def eHFallbackServerError(eHFallbackServerError:EHFallbackServerError): ErrorHandlingOperationError = EHFallbackServerErrorCase(eHFallbackServerError)
object EHFallbackClientErrorCase {
@@ -142,10 +148,7 @@ object ErrorHandlingServiceOperation {
EHNotFoundCase.alt,
EHFallbackServerErrorCase.alt,
){
- case c: EHFallbackClientErrorCase => EHFallbackClientErrorCase.alt(c)
- case c: EHServiceUnavailableCase => EHServiceUnavailableCase.alt(c)
- case c: EHNotFoundCase => EHNotFoundCase.alt(c)
- case c: EHFallbackServerErrorCase => EHFallbackServerErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingServiceExtraErrors.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingServiceExtraErrors.scala
index 8a4250fa0..f0fd8c73f 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingServiceExtraErrors.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingServiceExtraErrors.scala
@@ -38,11 +38,13 @@ object ErrorHandlingServiceExtraErrorsGen extends Service.Mixin[ErrorHandlingSer
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[ErrorHandlingServiceExtraErrorsOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[ErrorHandlingServiceExtraErrorsOperation, _, _, _, _, _]] = Vector(
ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperation,
)
- def endpoint[I, E, O, SI, SO](op: ErrorHandlingServiceExtraErrorsOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ErrorHandlingServiceExtraErrorsOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ErrorHandlingServiceExtraErrorsOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ErrorHandlingServiceExtraErrorsOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ErrorHandlingServiceExtraErrorsOperation.Transformed[ErrorHandlingServiceExtraErrorsOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ErrorHandlingServiceExtraErrorsGen[ErrorHandlingServiceExtraErrorsOperation] = ErrorHandlingServiceExtraErrorsOperation.reified
@@ -56,7 +58,9 @@ object ErrorHandlingServiceExtraErrorsGen extends Service.Mixin[ErrorHandlingSer
sealed trait ErrorHandlingServiceExtraErrorsOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ErrorHandlingServiceExtraErrorsGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ErrorHandlingServiceExtraErrorsOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ErrorHandlingServiceExtraErrorsOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ErrorHandlingServiceExtraErrorsOperation {
@@ -73,7 +77,8 @@ object ErrorHandlingServiceExtraErrorsOperation {
}
final case class ExtraErrorOperation(input: ExtraErrorOperationInput) extends ErrorHandlingServiceExtraErrorsOperation[ExtraErrorOperationInput, ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperationError, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ErrorHandlingServiceExtraErrorsGen[F]): F[ExtraErrorOperationInput, ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperationError, Unit, Nothing, Nothing] = impl.extraErrorOperation(input.in)
- def endpoint: (ExtraErrorOperationInput, smithy4s.Endpoint[ErrorHandlingServiceExtraErrorsOperation,ExtraErrorOperationInput, ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperationError, Unit, Nothing, Nothing]) = (input, ExtraErrorOperation)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[ErrorHandlingServiceExtraErrorsOperation,ExtraErrorOperationInput, ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperationError, Unit, Nothing, Nothing] = ExtraErrorOperation
}
object ExtraErrorOperation extends smithy4s.Endpoint[ErrorHandlingServiceExtraErrorsOperation,ExtraErrorOperationInput, ErrorHandlingServiceExtraErrorsOperation.ExtraErrorOperationError, Unit, Nothing, Nothing] with Errorable[ExtraErrorOperationError] {
val id: ShapeId = ShapeId("smithy4s.example", "ExtraErrorOperation")
@@ -101,19 +106,20 @@ object ErrorHandlingServiceExtraErrorsOperation {
}
sealed trait ExtraErrorOperationError extends scala.Product with scala.Serializable {
@inline final def widen: ExtraErrorOperationError = this
+ def _ordinal: Int
}
object ExtraErrorOperationError extends ShapeTag.Companion[ExtraErrorOperationError] {
val id: ShapeId = ShapeId("smithy4s.example", "ExtraErrorOperationError")
val hints: Hints = Hints.empty
- final case class RandomOtherClientErrorCase(randomOtherClientError: RandomOtherClientError) extends ExtraErrorOperationError
+ final case class RandomOtherClientErrorCase(randomOtherClientError: RandomOtherClientError) extends ExtraErrorOperationError { final def _ordinal: Int = 0 }
def randomOtherClientError(randomOtherClientError:RandomOtherClientError): ExtraErrorOperationError = RandomOtherClientErrorCase(randomOtherClientError)
- final case class RandomOtherServerErrorCase(randomOtherServerError: RandomOtherServerError) extends ExtraErrorOperationError
+ final case class RandomOtherServerErrorCase(randomOtherServerError: RandomOtherServerError) extends ExtraErrorOperationError { final def _ordinal: Int = 1 }
def randomOtherServerError(randomOtherServerError:RandomOtherServerError): ExtraErrorOperationError = RandomOtherServerErrorCase(randomOtherServerError)
- final case class RandomOtherClientErrorWithCodeCase(randomOtherClientErrorWithCode: RandomOtherClientErrorWithCode) extends ExtraErrorOperationError
+ final case class RandomOtherClientErrorWithCodeCase(randomOtherClientErrorWithCode: RandomOtherClientErrorWithCode) extends ExtraErrorOperationError { final def _ordinal: Int = 2 }
def randomOtherClientErrorWithCode(randomOtherClientErrorWithCode:RandomOtherClientErrorWithCode): ExtraErrorOperationError = RandomOtherClientErrorWithCodeCase(randomOtherClientErrorWithCode)
- final case class RandomOtherServerErrorWithCodeCase(randomOtherServerErrorWithCode: RandomOtherServerErrorWithCode) extends ExtraErrorOperationError
+ final case class RandomOtherServerErrorWithCodeCase(randomOtherServerErrorWithCode: RandomOtherServerErrorWithCode) extends ExtraErrorOperationError { final def _ordinal: Int = 3 }
def randomOtherServerErrorWithCode(randomOtherServerErrorWithCode:RandomOtherServerErrorWithCode): ExtraErrorOperationError = RandomOtherServerErrorWithCodeCase(randomOtherServerErrorWithCode)
object RandomOtherClientErrorCase {
@@ -143,10 +149,7 @@ object ErrorHandlingServiceExtraErrorsOperation {
RandomOtherClientErrorWithCodeCase.alt,
RandomOtherServerErrorWithCodeCase.alt,
){
- case c: RandomOtherClientErrorCase => RandomOtherClientErrorCase.alt(c)
- case c: RandomOtherServerErrorCase => RandomOtherServerErrorCase.alt(c)
- case c: RandomOtherClientErrorWithCodeCase => RandomOtherClientErrorWithCodeCase.alt(c)
- case c: RandomOtherServerErrorWithCodeCase => RandomOtherServerErrorWithCodeCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Foo.scala b/modules/bootstrapped/src/generated/smithy4s/example/Foo.scala
index c5feaaf19..7f3a5ffae 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/Foo.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/Foo.scala
@@ -16,6 +16,7 @@ import smithy4s.schema.Schema.union
*/
sealed trait Foo extends scala.Product with scala.Serializable {
@inline final def widen: Foo = this
+ def _ordinal: Int
}
object Foo extends ShapeTag.Companion[Foo] {
val id: ShapeId = ShapeId("smithy4s.example", "Foo")
@@ -24,16 +25,16 @@ object Foo extends ShapeTag.Companion[Foo] {
smithy.api.Documentation("Helpful information for Foo\nint, bigInt and bDec are useful number constructs\nThe string case is there because."),
)
- final case class IntCase(int: Int) extends Foo
+ final case class IntCase(int: Int) extends Foo { final def _ordinal: Int = 0 }
def int(int:Int): Foo = IntCase(int)
/** this is a comment saying you should be careful for this case
* you never know what lies ahead with Strings like this
*/
- final case class StrCase(str: String) extends Foo
+ final case class StrCase(str: String) extends Foo { final def _ordinal: Int = 1 }
def str(str:String): Foo = StrCase(str)
- final case class BIntCase(bInt: BigInt) extends Foo
+ final case class BIntCase(bInt: BigInt) extends Foo { final def _ordinal: Int = 2 }
def bInt(bInt:BigInt): Foo = BIntCase(bInt)
- final case class BDecCase(bDec: BigDecimal) extends Foo
+ final case class BDecCase(bDec: BigDecimal) extends Foo { final def _ordinal: Int = 3 }
def bDec(bDec:BigDecimal): Foo = BDecCase(bDec)
object IntCase {
@@ -65,9 +66,6 @@ object Foo extends ShapeTag.Companion[Foo] {
BIntCase.alt,
BDecCase.alt,
){
- case c: IntCase => IntCase.alt(c)
- case c: StrCase => StrCase.alt(c)
- case c: BIntCase => BIntCase.alt(c)
- case c: BDecCase => BDecCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/FooService.scala b/modules/bootstrapped/src/generated/smithy4s/example/FooService.scala
index 5de971055..b59d0848b 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/FooService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/FooService.scala
@@ -42,11 +42,13 @@ object FooServiceGen extends Service.Mixin[FooServiceGen, FooServiceOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[FooServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[FooServiceOperation, _, _, _, _, _]] = Vector(
FooServiceOperation.GetFoo,
)
- def endpoint[I, E, O, SI, SO](op: FooServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: FooServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: FooServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: FooServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends FooServiceOperation.Transformed[FooServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: FooServiceGen[FooServiceOperation] = FooServiceOperation.reified
@@ -58,7 +60,9 @@ object FooServiceGen extends Service.Mixin[FooServiceGen, FooServiceOperation] {
sealed trait FooServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: FooServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[FooServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[FooServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object FooServiceOperation {
@@ -75,7 +79,9 @@ object FooServiceOperation {
}
final case class GetFoo() extends FooServiceOperation[Unit, Nothing, GetFooOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: FooServiceGen[F]): F[Unit, Nothing, GetFooOutput, Nothing, Nothing] = impl.getFoo()
- def endpoint: (Unit, smithy4s.Endpoint[FooServiceOperation,Unit, Nothing, GetFooOutput, Nothing, Nothing]) = ((), GetFoo)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[FooServiceOperation,Unit, Nothing, GetFooOutput, Nothing, Nothing] = GetFoo
}
object GetFoo extends smithy4s.Endpoint[FooServiceOperation,Unit, Nothing, GetFooOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "GetFoo")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Food.scala b/modules/bootstrapped/src/generated/smithy4s/example/Food.scala
index 06fb8b036..b1a8d97c2 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/Food.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/Food.scala
@@ -9,15 +9,16 @@ import smithy4s.schema.Schema.union
sealed trait Food extends scala.Product with scala.Serializable {
@inline final def widen: Food = this
+ def _ordinal: Int
}
object Food extends ShapeTag.Companion[Food] {
val id: ShapeId = ShapeId("smithy4s.example", "Food")
val hints: Hints = Hints.empty
- final case class PizzaCase(pizza: Pizza) extends Food
+ final case class PizzaCase(pizza: Pizza) extends Food { final def _ordinal: Int = 0 }
def pizza(pizza:Pizza): Food = PizzaCase(pizza)
- final case class SaladCase(salad: Salad) extends Food
+ final case class SaladCase(salad: Salad) extends Food { final def _ordinal: Int = 1 }
def salad(salad:Salad): Food = SaladCase(salad)
object PizzaCase {
@@ -35,7 +36,6 @@ object Food extends ShapeTag.Companion[Food] {
PizzaCase.alt,
SaladCase.alt,
){
- case c: PizzaCase => PizzaCase.alt(c)
- case c: SaladCase => SaladCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ForecastResult.scala b/modules/bootstrapped/src/generated/smithy4s/example/ForecastResult.scala
index 891e79c69..608e37893 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/ForecastResult.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/ForecastResult.scala
@@ -9,15 +9,16 @@ import smithy4s.schema.Schema.union
sealed trait ForecastResult extends scala.Product with scala.Serializable {
@inline final def widen: ForecastResult = this
+ def _ordinal: Int
}
object ForecastResult extends ShapeTag.Companion[ForecastResult] {
val id: ShapeId = ShapeId("smithy4s.example", "ForecastResult")
val hints: Hints = Hints.empty
- final case class RainCase(rain: ChanceOfRain) extends ForecastResult
+ final case class RainCase(rain: ChanceOfRain) extends ForecastResult { final def _ordinal: Int = 0 }
def rain(rain:ChanceOfRain): ForecastResult = RainCase(rain)
- final case class SunCase(sun: UVIndex) extends ForecastResult
+ final case class SunCase(sun: UVIndex) extends ForecastResult { final def _ordinal: Int = 1 }
def sun(sun:UVIndex): ForecastResult = SunCase(sun)
object RainCase {
@@ -35,7 +36,6 @@ object ForecastResult extends ShapeTag.Companion[ForecastResult] {
RainCase.alt,
SunCase.alt,
){
- case c: RainCase => RainCase.alt(c)
- case c: SunCase => SunCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/KVStore.scala b/modules/bootstrapped/src/generated/smithy4s/example/KVStore.scala
index 4d3230fed..510fced07 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/KVStore.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/KVStore.scala
@@ -40,13 +40,15 @@ object KVStoreGen extends Service.Mixin[KVStoreGen, KVStoreOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[KVStoreOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[KVStoreOperation, _, _, _, _, _]] = Vector(
KVStoreOperation.Get,
KVStoreOperation.Put,
KVStoreOperation.Delete,
)
- def endpoint[I, E, O, SI, SO](op: KVStoreOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: KVStoreOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: KVStoreOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: KVStoreOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends KVStoreOperation.Transformed[KVStoreOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: KVStoreGen[KVStoreOperation] = KVStoreOperation.reified
@@ -64,7 +66,9 @@ object KVStoreGen extends Service.Mixin[KVStoreGen, KVStoreOperation] {
sealed trait KVStoreOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: KVStoreGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[KVStoreOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[KVStoreOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object KVStoreOperation {
@@ -85,7 +89,8 @@ object KVStoreOperation {
}
final case class Get(input: Key) extends KVStoreOperation[Key, KVStoreOperation.GetError, Value, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: KVStoreGen[F]): F[Key, KVStoreOperation.GetError, Value, Nothing, Nothing] = impl.get(input.key)
- def endpoint: (Key, smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.GetError, Value, Nothing, Nothing]) = (input, Get)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.GetError, Value, Nothing, Nothing] = Get
}
object Get extends smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.GetError, Value, Nothing, Nothing] with Errorable[GetError] {
val id: ShapeId = ShapeId("smithy4s.example", "Get")
@@ -109,15 +114,16 @@ object KVStoreOperation {
}
sealed trait GetError extends scala.Product with scala.Serializable {
@inline final def widen: GetError = this
+ def _ordinal: Int
}
object GetError extends ShapeTag.Companion[GetError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetError")
val hints: Hints = Hints.empty
- final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends GetError
+ final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends GetError { final def _ordinal: Int = 0 }
def unauthorizedError(unauthorizedError:UnauthorizedError): GetError = UnauthorizedErrorCase(unauthorizedError)
- final case class KeyNotFoundErrorCase(keyNotFoundError: KeyNotFoundError) extends GetError
+ final case class KeyNotFoundErrorCase(keyNotFoundError: KeyNotFoundError) extends GetError { final def _ordinal: Int = 1 }
def keyNotFoundError(keyNotFoundError:KeyNotFoundError): GetError = KeyNotFoundErrorCase(keyNotFoundError)
object UnauthorizedErrorCase {
@@ -135,13 +141,13 @@ object KVStoreOperation {
UnauthorizedErrorCase.alt,
KeyNotFoundErrorCase.alt,
){
- case c: UnauthorizedErrorCase => UnauthorizedErrorCase.alt(c)
- case c: KeyNotFoundErrorCase => KeyNotFoundErrorCase.alt(c)
+ _._ordinal
}
}
final case class Put(input: KeyValue) extends KVStoreOperation[KeyValue, KVStoreOperation.PutError, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: KVStoreGen[F]): F[KeyValue, KVStoreOperation.PutError, Unit, Nothing, Nothing] = impl.put(input.key, input.value)
- def endpoint: (KeyValue, smithy4s.Endpoint[KVStoreOperation,KeyValue, KVStoreOperation.PutError, Unit, Nothing, Nothing]) = (input, Put)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[KVStoreOperation,KeyValue, KVStoreOperation.PutError, Unit, Nothing, Nothing] = Put
}
object Put extends smithy4s.Endpoint[KVStoreOperation,KeyValue, KVStoreOperation.PutError, Unit, Nothing, Nothing] with Errorable[PutError] {
val id: ShapeId = ShapeId("smithy4s.example", "Put")
@@ -163,13 +169,14 @@ object KVStoreOperation {
}
sealed trait PutError extends scala.Product with scala.Serializable {
@inline final def widen: PutError = this
+ def _ordinal: Int
}
object PutError extends ShapeTag.Companion[PutError] {
val id: ShapeId = ShapeId("smithy4s.example", "PutError")
val hints: Hints = Hints.empty
- final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends PutError
+ final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends PutError { final def _ordinal: Int = 0 }
def unauthorizedError(unauthorizedError:UnauthorizedError): PutError = UnauthorizedErrorCase(unauthorizedError)
object UnauthorizedErrorCase {
@@ -181,12 +188,13 @@ object KVStoreOperation {
implicit val schema: UnionSchema[PutError] = union(
UnauthorizedErrorCase.alt,
){
- case c: UnauthorizedErrorCase => UnauthorizedErrorCase.alt(c)
+ _._ordinal
}
}
final case class Delete(input: Key) extends KVStoreOperation[Key, KVStoreOperation.DeleteError, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: KVStoreGen[F]): F[Key, KVStoreOperation.DeleteError, Unit, Nothing, Nothing] = impl.delete(input.key)
- def endpoint: (Key, smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.DeleteError, Unit, Nothing, Nothing]) = (input, Delete)
+ def ordinal = 2
+ def endpoint: smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.DeleteError, Unit, Nothing, Nothing] = Delete
}
object Delete extends smithy4s.Endpoint[KVStoreOperation,Key, KVStoreOperation.DeleteError, Unit, Nothing, Nothing] with Errorable[DeleteError] {
val id: ShapeId = ShapeId("smithy4s.example", "Delete")
@@ -210,15 +218,16 @@ object KVStoreOperation {
}
sealed trait DeleteError extends scala.Product with scala.Serializable {
@inline final def widen: DeleteError = this
+ def _ordinal: Int
}
object DeleteError extends ShapeTag.Companion[DeleteError] {
val id: ShapeId = ShapeId("smithy4s.example", "DeleteError")
val hints: Hints = Hints.empty
- final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends DeleteError
+ final case class UnauthorizedErrorCase(unauthorizedError: UnauthorizedError) extends DeleteError { final def _ordinal: Int = 0 }
def unauthorizedError(unauthorizedError:UnauthorizedError): DeleteError = UnauthorizedErrorCase(unauthorizedError)
- final case class KeyNotFoundErrorCase(keyNotFoundError: KeyNotFoundError) extends DeleteError
+ final case class KeyNotFoundErrorCase(keyNotFoundError: KeyNotFoundError) extends DeleteError { final def _ordinal: Int = 1 }
def keyNotFoundError(keyNotFoundError:KeyNotFoundError): DeleteError = KeyNotFoundErrorCase(keyNotFoundError)
object UnauthorizedErrorCase {
@@ -236,8 +245,7 @@ object KVStoreOperation {
UnauthorizedErrorCase.alt,
KeyNotFoundErrorCase.alt,
){
- case c: UnauthorizedErrorCase => UnauthorizedErrorCase.alt(c)
- case c: KeyNotFoundErrorCase => KeyNotFoundErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Library.scala b/modules/bootstrapped/src/generated/smithy4s/example/Library.scala
index 0353f784a..4888bf099 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/Library.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/Library.scala
@@ -35,13 +35,15 @@ object LibraryGen extends Service.Mixin[LibraryGen, LibraryOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[LibraryOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[LibraryOperation, _, _, _, _, _]] = Vector(
LibraryOperation.ListPublishers,
LibraryOperation.GetBook,
LibraryOperation.BuyBook,
)
- def endpoint[I, E, O, SI, SO](op: LibraryOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: LibraryOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: LibraryOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: LibraryOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends LibraryOperation.Transformed[LibraryOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: LibraryGen[LibraryOperation] = LibraryOperation.reified
@@ -53,7 +55,9 @@ object LibraryGen extends Service.Mixin[LibraryGen, LibraryOperation] {
sealed trait LibraryOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: LibraryGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[LibraryOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[LibraryOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object LibraryOperation {
@@ -74,7 +78,9 @@ object LibraryOperation {
}
final case class ListPublishers() extends LibraryOperation[Unit, Nothing, ListPublishersOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: LibraryGen[F]): F[Unit, Nothing, ListPublishersOutput, Nothing, Nothing] = impl.listPublishers()
- def endpoint: (Unit, smithy4s.Endpoint[LibraryOperation,Unit, Nothing, ListPublishersOutput, Nothing, Nothing]) = ((), ListPublishers)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[LibraryOperation,Unit, Nothing, ListPublishersOutput, Nothing, Nothing] = ListPublishers
}
object ListPublishers extends smithy4s.Endpoint[LibraryOperation,Unit, Nothing, ListPublishersOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "ListPublishers")
@@ -90,7 +96,9 @@ object LibraryOperation {
}
final case class GetBook() extends LibraryOperation[Unit, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: LibraryGen[F]): F[Unit, Nothing, Unit, Nothing, Nothing] = impl.getBook()
- def endpoint: (Unit, smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing]) = ((), GetBook)
+ def ordinal = 1
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing] = GetBook
}
object GetBook extends smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "GetBook")
@@ -106,7 +114,9 @@ object LibraryOperation {
}
final case class BuyBook() extends LibraryOperation[Unit, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: LibraryGen[F]): F[Unit, Nothing, Unit, Nothing, Nothing] = impl.buyBook()
- def endpoint: (Unit, smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing]) = ((), BuyBook)
+ def ordinal = 2
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing] = BuyBook
}
object BuyBook extends smithy4s.Endpoint[LibraryOperation,Unit, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "BuyBook")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NameCollision.scala b/modules/bootstrapped/src/generated/smithy4s/example/NameCollision.scala
index 5d5b8d277..99dd07edc 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/NameCollision.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/NameCollision.scala
@@ -38,12 +38,14 @@ object NameCollisionGen extends Service.Mixin[NameCollisionGen, NameCollisionOpe
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[NameCollisionOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[NameCollisionOperation, _, _, _, _, _]] = Vector(
NameCollisionOperation.MyOp,
NameCollisionOperation.Endpoint,
)
- def endpoint[I, E, O, SI, SO](op: NameCollisionOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: NameCollisionOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: NameCollisionOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: NameCollisionOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends NameCollisionOperation.Transformed[NameCollisionOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: NameCollisionGen[NameCollisionOperation] = NameCollisionOperation.reified
@@ -57,7 +59,9 @@ object NameCollisionGen extends Service.Mixin[NameCollisionGen, NameCollisionOpe
sealed trait NameCollisionOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: NameCollisionGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, smithy4s.Endpoint[NameCollisionOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: smithy4s.Endpoint[NameCollisionOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object NameCollisionOperation {
@@ -76,7 +80,9 @@ object NameCollisionOperation {
}
final case class MyOp() extends NameCollisionOperation[Unit, NameCollisionOperation.MyOpError, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: NameCollisionGen[F]): F[Unit, NameCollisionOperation.MyOpError, Unit, Nothing, Nothing] = impl.myOp()
- def endpoint: (Unit, smithy4s.Endpoint[NameCollisionOperation,Unit, NameCollisionOperation.MyOpError, Unit, Nothing, Nothing]) = ((), MyOp)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[NameCollisionOperation,Unit, NameCollisionOperation.MyOpError, Unit, Nothing, Nothing] = MyOp
}
object MyOp extends smithy4s.Endpoint[NameCollisionOperation,Unit, NameCollisionOperation.MyOpError, Unit, Nothing, Nothing] with Errorable[MyOpError] {
val id: ShapeId = ShapeId("smithy4s.example", "MyOp")
@@ -98,13 +104,14 @@ object NameCollisionOperation {
}
sealed trait MyOpError extends scala.Product with scala.Serializable {
@inline final def widen: MyOpError = this
+ def _ordinal: Int
}
object MyOpError extends ShapeTag.Companion[MyOpError] {
val id: ShapeId = ShapeId("smithy4s.example", "MyOpError")
val hints: Hints = Hints.empty
- final case class MyOpErrorCase(myOpError: smithy4s.example.MyOpError) extends MyOpError
+ final case class MyOpErrorCase(myOpError: smithy4s.example.MyOpError) extends MyOpError { final def _ordinal: Int = 0 }
def myOpError(myOpError:smithy4s.example.MyOpError): MyOpError = MyOpErrorCase(myOpError)
object MyOpErrorCase {
@@ -116,12 +123,14 @@ object NameCollisionOperation {
implicit val schema: UnionSchema[MyOpError] = union(
MyOpErrorCase.alt,
){
- case c: MyOpErrorCase => MyOpErrorCase.alt(c)
+ _._ordinal
}
}
final case class Endpoint() extends NameCollisionOperation[Unit, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: NameCollisionGen[F]): F[Unit, Nothing, Unit, Nothing, Nothing] = impl.endpoint()
- def endpoint: (Unit, smithy4s.Endpoint[NameCollisionOperation,Unit, Nothing, Unit, Nothing, Nothing]) = ((), Endpoint)
+ def ordinal = 1
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[NameCollisionOperation,Unit, Nothing, Unit, Nothing, Nothing] = Endpoint
}
object Endpoint extends smithy4s.Endpoint[NameCollisionOperation,Unit, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "Endpoint")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ObjectService.scala b/modules/bootstrapped/src/generated/smithy4s/example/ObjectService.scala
index aec497e79..42ae268cb 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/ObjectService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/ObjectService.scala
@@ -48,12 +48,14 @@ object ObjectServiceGen extends Service.Mixin[ObjectServiceGen, ObjectServiceOpe
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[ObjectServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[ObjectServiceOperation, _, _, _, _, _]] = Vector(
ObjectServiceOperation.PutObject,
ObjectServiceOperation.GetObject,
)
- def endpoint[I, E, O, SI, SO](op: ObjectServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ObjectServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ObjectServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ObjectServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ObjectServiceOperation.Transformed[ObjectServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ObjectServiceGen[ObjectServiceOperation] = ObjectServiceOperation.reified
@@ -69,7 +71,9 @@ object ObjectServiceGen extends Service.Mixin[ObjectServiceGen, ObjectServiceOpe
sealed trait ObjectServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ObjectServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ObjectServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ObjectServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ObjectServiceOperation {
@@ -88,7 +92,8 @@ object ObjectServiceOperation {
}
final case class PutObject(input: PutObjectInput) extends ObjectServiceOperation[PutObjectInput, ObjectServiceOperation.PutObjectError, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ObjectServiceGen[F]): F[PutObjectInput, ObjectServiceOperation.PutObjectError, Unit, Nothing, Nothing] = impl.putObject(input.key, input.bucketName, input.data, input.foo, input.someValue)
- def endpoint: (PutObjectInput, smithy4s.Endpoint[ObjectServiceOperation,PutObjectInput, ObjectServiceOperation.PutObjectError, Unit, Nothing, Nothing]) = (input, PutObject)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[ObjectServiceOperation,PutObjectInput, ObjectServiceOperation.PutObjectError, Unit, Nothing, Nothing] = PutObject
}
object PutObject extends smithy4s.Endpoint[ObjectServiceOperation,PutObjectInput, ObjectServiceOperation.PutObjectError, Unit, Nothing, Nothing] with Errorable[PutObjectError] {
val id: ShapeId = ShapeId("smithy4s.example", "PutObject")
@@ -115,15 +120,16 @@ object ObjectServiceOperation {
}
sealed trait PutObjectError extends scala.Product with scala.Serializable {
@inline final def widen: PutObjectError = this
+ def _ordinal: Int
}
object PutObjectError extends ShapeTag.Companion[PutObjectError] {
val id: ShapeId = ShapeId("smithy4s.example", "PutObjectError")
val hints: Hints = Hints.empty
- final case class ServerErrorCase(serverError: ServerError) extends PutObjectError
+ final case class ServerErrorCase(serverError: ServerError) extends PutObjectError { final def _ordinal: Int = 0 }
def serverError(serverError:ServerError): PutObjectError = ServerErrorCase(serverError)
- final case class NoMoreSpaceCase(noMoreSpace: NoMoreSpace) extends PutObjectError
+ final case class NoMoreSpaceCase(noMoreSpace: NoMoreSpace) extends PutObjectError { final def _ordinal: Int = 1 }
def noMoreSpace(noMoreSpace:NoMoreSpace): PutObjectError = NoMoreSpaceCase(noMoreSpace)
object ServerErrorCase {
@@ -141,13 +147,13 @@ object ObjectServiceOperation {
ServerErrorCase.alt,
NoMoreSpaceCase.alt,
){
- case c: ServerErrorCase => ServerErrorCase.alt(c)
- case c: NoMoreSpaceCase => NoMoreSpaceCase.alt(c)
+ _._ordinal
}
}
final case class GetObject(input: GetObjectInput) extends ObjectServiceOperation[GetObjectInput, ObjectServiceOperation.GetObjectError, GetObjectOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ObjectServiceGen[F]): F[GetObjectInput, ObjectServiceOperation.GetObjectError, GetObjectOutput, Nothing, Nothing] = impl.getObject(input.key, input.bucketName)
- def endpoint: (GetObjectInput, smithy4s.Endpoint[ObjectServiceOperation,GetObjectInput, ObjectServiceOperation.GetObjectError, GetObjectOutput, Nothing, Nothing]) = (input, GetObject)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[ObjectServiceOperation,GetObjectInput, ObjectServiceOperation.GetObjectError, GetObjectOutput, Nothing, Nothing] = GetObject
}
object GetObject extends smithy4s.Endpoint[ObjectServiceOperation,GetObjectInput, ObjectServiceOperation.GetObjectError, GetObjectOutput, Nothing, Nothing] with Errorable[GetObjectError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetObject")
@@ -172,13 +178,14 @@ object ObjectServiceOperation {
}
sealed trait GetObjectError extends scala.Product with scala.Serializable {
@inline final def widen: GetObjectError = this
+ def _ordinal: Int
}
object GetObjectError extends ShapeTag.Companion[GetObjectError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetObjectError")
val hints: Hints = Hints.empty
- final case class ServerErrorCase(serverError: ServerError) extends GetObjectError
+ final case class ServerErrorCase(serverError: ServerError) extends GetObjectError { final def _ordinal: Int = 0 }
def serverError(serverError:ServerError): GetObjectError = ServerErrorCase(serverError)
object ServerErrorCase {
@@ -190,7 +197,7 @@ object ObjectServiceOperation {
implicit val schema: UnionSchema[GetObjectError] = union(
ServerErrorCase.alt,
){
- case c: ServerErrorCase => ServerErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala b/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala
index 4e34edcb3..52628241d 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala
@@ -14,6 +14,7 @@ import smithy4s.schema.Schema.union
*/
sealed trait OrderType extends scala.Product with scala.Serializable {
@inline final def widen: OrderType = this
+ def _ordinal: Int
}
object OrderType extends ShapeTag.Companion[OrderType] {
val id: ShapeId = ShapeId("smithy4s.example", "OrderType")
@@ -22,10 +23,12 @@ object OrderType extends ShapeTag.Companion[OrderType] {
smithy.api.Documentation("Our order types have different ways to identify a product\nExcept for preview orders, these don\'t have an ID "),
)
- final case class OnlineCase(online: OrderNumber) extends OrderType
+ final case class OnlineCase(online: OrderNumber) extends OrderType { final def _ordinal: Int = 0 }
def online(online:OrderNumber): OrderType = OnlineCase(online)
/** For an InStoreOrder a location ID isn't needed */
- final case class InStoreOrder(id: OrderNumber, locationId: Option[String] = None) extends OrderType
+ final case class InStoreOrder(id: OrderNumber, locationId: Option[String] = None) extends OrderType {
+ def _ordinal: Int = 1
+ }
object InStoreOrder extends ShapeTag.Companion[InStoreOrder] {
val id: ShapeId = ShapeId("smithy4s.example", "InStoreOrder")
@@ -42,10 +45,9 @@ object OrderType extends ShapeTag.Companion[OrderType] {
val alt = schema.oneOf[OrderType]("inStore")
}
- case object PreviewCase extends OrderType
+ case object PreviewCase extends OrderType { final def _ordinal: Int = 2 }
def preview(): OrderType = PreviewCase
private val PreviewCaseAlt = Schema.constant(PreviewCase).oneOf[OrderType]("preview").addHints(hints)
- private val PreviewCaseAltWithValue = PreviewCaseAlt(PreviewCase)
object OnlineCase {
val hints: Hints = Hints.empty
@@ -58,8 +60,6 @@ object OrderType extends ShapeTag.Companion[OrderType] {
InStoreOrder.alt,
PreviewCaseAlt,
){
- case c: OnlineCase => OnlineCase.alt(c)
- case c: InStoreOrder => InStoreOrder.alt(c)
- case PreviewCase => PreviewCaseAltWithValue
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PackedInputsService.scala b/modules/bootstrapped/src/generated/smithy4s/example/PackedInputsService.scala
index 7aa0eee67..096393a53 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/PackedInputsService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/PackedInputsService.scala
@@ -33,11 +33,13 @@ object PackedInputsServiceGen extends Service.Mixin[PackedInputsServiceGen, Pack
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[PackedInputsServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[PackedInputsServiceOperation, _, _, _, _, _]] = Vector(
PackedInputsServiceOperation.PackedInputOperation,
)
- def endpoint[I, E, O, SI, SO](op: PackedInputsServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: PackedInputsServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: PackedInputsServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: PackedInputsServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends PackedInputsServiceOperation.Transformed[PackedInputsServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: PackedInputsServiceGen[PackedInputsServiceOperation] = PackedInputsServiceOperation.reified
@@ -49,7 +51,9 @@ object PackedInputsServiceGen extends Service.Mixin[PackedInputsServiceGen, Pack
sealed trait PackedInputsServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: PackedInputsServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[PackedInputsServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[PackedInputsServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object PackedInputsServiceOperation {
@@ -66,7 +70,8 @@ object PackedInputsServiceOperation {
}
final case class PackedInputOperation(input: PackedInput) extends PackedInputsServiceOperation[PackedInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PackedInputsServiceGen[F]): F[PackedInput, Nothing, Unit, Nothing, Nothing] = impl.packedInputOperation(input)
- def endpoint: (PackedInput, smithy4s.Endpoint[PackedInputsServiceOperation,PackedInput, Nothing, Unit, Nothing, Nothing]) = (input, PackedInputOperation)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[PackedInputsServiceOperation,PackedInput, Nothing, Unit, Nothing, Nothing] = PackedInputOperation
}
object PackedInputOperation extends smithy4s.Endpoint[PackedInputsServiceOperation,PackedInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "PackedInputOperation")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PersonContactInfo.scala b/modules/bootstrapped/src/generated/smithy4s/example/PersonContactInfo.scala
index f4e78fb1a..300675ff9 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/PersonContactInfo.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/PersonContactInfo.scala
@@ -10,6 +10,7 @@ import smithy4s.schema.Schema.union
sealed trait PersonContactInfo extends scala.Product with scala.Serializable {
@inline final def widen: PersonContactInfo = this
+ def _ordinal: Int
}
object PersonContactInfo extends ShapeTag.Companion[PersonContactInfo] {
val id: ShapeId = ShapeId("smithy4s.example", "PersonContactInfo")
@@ -18,9 +19,9 @@ object PersonContactInfo extends ShapeTag.Companion[PersonContactInfo] {
smithy4s.example.Hash(),
)
- final case class EmailCase(email: PersonEmail) extends PersonContactInfo
+ final case class EmailCase(email: PersonEmail) extends PersonContactInfo { final def _ordinal: Int = 0 }
def email(email:PersonEmail): PersonContactInfo = EmailCase(email)
- final case class PhoneCase(phone: PersonPhoneNumber) extends PersonContactInfo
+ final case class PhoneCase(phone: PersonPhoneNumber) extends PersonContactInfo { final def _ordinal: Int = 1 }
def phone(phone:PersonPhoneNumber): PersonContactInfo = PhoneCase(phone)
object EmailCase {
@@ -38,8 +39,7 @@ object PersonContactInfo extends ShapeTag.Companion[PersonContactInfo] {
EmailCase.alt,
PhoneCase.alt,
){
- case c: EmailCase => EmailCase.alt(c)
- case c: PhoneCase => PhoneCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
implicit val personContactInfoHash: cats.Hash[PersonContactInfo] = SchemaVisitorHash.fromSchema(schema)
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PizzaAdminService.scala b/modules/bootstrapped/src/generated/smithy4s/example/PizzaAdminService.scala
index 57fd83367..a449b12e5 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/PizzaAdminService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/PizzaAdminService.scala
@@ -51,7 +51,7 @@ object PizzaAdminServiceGen extends Service.Mixin[PizzaAdminServiceGen, PizzaAdm
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[PizzaAdminServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[PizzaAdminServiceOperation, _, _, _, _, _]] = Vector(
PizzaAdminServiceOperation.AddMenuItem,
PizzaAdminServiceOperation.GetMenu,
PizzaAdminServiceOperation.Version,
@@ -66,7 +66,9 @@ object PizzaAdminServiceGen extends Service.Mixin[PizzaAdminServiceGen, PizzaAdm
PizzaAdminServiceOperation.OptionalOutput,
)
- def endpoint[I, E, O, SI, SO](op: PizzaAdminServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: PizzaAdminServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: PizzaAdminServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: PizzaAdminServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends PizzaAdminServiceOperation.Transformed[PizzaAdminServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: PizzaAdminServiceGen[PizzaAdminServiceOperation] = PizzaAdminServiceOperation.reified
@@ -90,7 +92,9 @@ object PizzaAdminServiceGen extends Service.Mixin[PizzaAdminServiceGen, PizzaAdm
sealed trait PizzaAdminServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[PizzaAdminServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[PizzaAdminServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object PizzaAdminServiceOperation {
@@ -129,7 +133,8 @@ object PizzaAdminServiceOperation {
}
final case class AddMenuItem(input: AddMenuItemRequest) extends PizzaAdminServiceOperation[AddMenuItemRequest, PizzaAdminServiceOperation.AddMenuItemError, AddMenuItemResult, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[AddMenuItemRequest, PizzaAdminServiceOperation.AddMenuItemError, AddMenuItemResult, Nothing, Nothing] = impl.addMenuItem(input.restaurant, input.menuItem)
- def endpoint: (AddMenuItemRequest, smithy4s.Endpoint[PizzaAdminServiceOperation,AddMenuItemRequest, PizzaAdminServiceOperation.AddMenuItemError, AddMenuItemResult, Nothing, Nothing]) = (input, AddMenuItem)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,AddMenuItemRequest, PizzaAdminServiceOperation.AddMenuItemError, AddMenuItemResult, Nothing, Nothing] = AddMenuItem
}
object AddMenuItem extends smithy4s.Endpoint[PizzaAdminServiceOperation,AddMenuItemRequest, PizzaAdminServiceOperation.AddMenuItemError, AddMenuItemResult, Nothing, Nothing] with Errorable[AddMenuItemError] {
val id: ShapeId = ShapeId("smithy4s.example", "AddMenuItem")
@@ -157,17 +162,18 @@ object PizzaAdminServiceOperation {
}
sealed trait AddMenuItemError extends scala.Product with scala.Serializable {
@inline final def widen: AddMenuItemError = this
+ def _ordinal: Int
}
object AddMenuItemError extends ShapeTag.Companion[AddMenuItemError] {
val id: ShapeId = ShapeId("smithy4s.example", "AddMenuItemError")
val hints: Hints = Hints.empty
- final case class PriceErrorCase(priceError: PriceError) extends AddMenuItemError
+ final case class PriceErrorCase(priceError: PriceError) extends AddMenuItemError { final def _ordinal: Int = 0 }
def priceError(priceError:PriceError): AddMenuItemError = PriceErrorCase(priceError)
- final case class GenericServerErrorCase(genericServerError: GenericServerError) extends AddMenuItemError
+ final case class GenericServerErrorCase(genericServerError: GenericServerError) extends AddMenuItemError { final def _ordinal: Int = 1 }
def genericServerError(genericServerError:GenericServerError): AddMenuItemError = GenericServerErrorCase(genericServerError)
- final case class GenericClientErrorCase(genericClientError: GenericClientError) extends AddMenuItemError
+ final case class GenericClientErrorCase(genericClientError: GenericClientError) extends AddMenuItemError { final def _ordinal: Int = 2 }
def genericClientError(genericClientError:GenericClientError): AddMenuItemError = GenericClientErrorCase(genericClientError)
object PriceErrorCase {
@@ -191,14 +197,13 @@ object PizzaAdminServiceOperation {
GenericServerErrorCase.alt,
GenericClientErrorCase.alt,
){
- case c: PriceErrorCase => PriceErrorCase.alt(c)
- case c: GenericServerErrorCase => GenericServerErrorCase.alt(c)
- case c: GenericClientErrorCase => GenericClientErrorCase.alt(c)
+ _._ordinal
}
}
final case class GetMenu(input: GetMenuRequest) extends PizzaAdminServiceOperation[GetMenuRequest, PizzaAdminServiceOperation.GetMenuError, GetMenuResult, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[GetMenuRequest, PizzaAdminServiceOperation.GetMenuError, GetMenuResult, Nothing, Nothing] = impl.getMenu(input.restaurant)
- def endpoint: (GetMenuRequest, smithy4s.Endpoint[PizzaAdminServiceOperation,GetMenuRequest, PizzaAdminServiceOperation.GetMenuError, GetMenuResult, Nothing, Nothing]) = (input, GetMenu)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,GetMenuRequest, PizzaAdminServiceOperation.GetMenuError, GetMenuResult, Nothing, Nothing] = GetMenu
}
object GetMenu extends smithy4s.Endpoint[PizzaAdminServiceOperation,GetMenuRequest, PizzaAdminServiceOperation.GetMenuError, GetMenuResult, Nothing, Nothing] with Errorable[GetMenuError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetMenu")
@@ -229,19 +234,20 @@ object PizzaAdminServiceOperation {
}
sealed trait GetMenuError extends scala.Product with scala.Serializable {
@inline final def widen: GetMenuError = this
+ def _ordinal: Int
}
object GetMenuError extends ShapeTag.Companion[GetMenuError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetMenuError")
val hints: Hints = Hints.empty
- final case class GenericClientErrorCase(genericClientError: GenericClientError) extends GetMenuError
+ final case class GenericClientErrorCase(genericClientError: GenericClientError) extends GetMenuError { final def _ordinal: Int = 0 }
def genericClientError(genericClientError:GenericClientError): GetMenuError = GenericClientErrorCase(genericClientError)
- final case class FallbackError2Case(fallbackError2: FallbackError2) extends GetMenuError
+ final case class FallbackError2Case(fallbackError2: FallbackError2) extends GetMenuError { final def _ordinal: Int = 1 }
def fallbackError2(fallbackError2:FallbackError2): GetMenuError = FallbackError2Case(fallbackError2)
- final case class FallbackErrorCase(fallbackError: FallbackError) extends GetMenuError
+ final case class FallbackErrorCase(fallbackError: FallbackError) extends GetMenuError { final def _ordinal: Int = 2 }
def fallbackError(fallbackError:FallbackError): GetMenuError = FallbackErrorCase(fallbackError)
- final case class NotFoundErrorCase(notFoundError: NotFoundError) extends GetMenuError
+ final case class NotFoundErrorCase(notFoundError: NotFoundError) extends GetMenuError { final def _ordinal: Int = 3 }
def notFoundError(notFoundError:NotFoundError): GetMenuError = NotFoundErrorCase(notFoundError)
object GenericClientErrorCase {
@@ -271,15 +277,14 @@ object PizzaAdminServiceOperation {
FallbackErrorCase.alt,
NotFoundErrorCase.alt,
){
- case c: GenericClientErrorCase => GenericClientErrorCase.alt(c)
- case c: FallbackError2Case => FallbackError2Case.alt(c)
- case c: FallbackErrorCase => FallbackErrorCase.alt(c)
- case c: NotFoundErrorCase => NotFoundErrorCase.alt(c)
+ _._ordinal
}
}
final case class Version() extends PizzaAdminServiceOperation[Unit, Nothing, VersionOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[Unit, Nothing, VersionOutput, Nothing, Nothing] = impl.version()
- def endpoint: (Unit, smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, VersionOutput, Nothing, Nothing]) = ((), Version)
+ def ordinal = 2
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, VersionOutput, Nothing, Nothing] = Version
}
object Version extends smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, VersionOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "Version")
@@ -296,7 +301,8 @@ object PizzaAdminServiceOperation {
}
final case class Health(input: HealthRequest) extends PizzaAdminServiceOperation[HealthRequest, PizzaAdminServiceOperation.HealthError, HealthResponse, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[HealthRequest, PizzaAdminServiceOperation.HealthError, HealthResponse, Nothing, Nothing] = impl.health(input.query)
- def endpoint: (HealthRequest, smithy4s.Endpoint[PizzaAdminServiceOperation,HealthRequest, PizzaAdminServiceOperation.HealthError, HealthResponse, Nothing, Nothing]) = (input, Health)
+ def ordinal = 3
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,HealthRequest, PizzaAdminServiceOperation.HealthError, HealthResponse, Nothing, Nothing] = Health
}
object Health extends smithy4s.Endpoint[PizzaAdminServiceOperation,HealthRequest, PizzaAdminServiceOperation.HealthError, HealthResponse, Nothing, Nothing] with Errorable[HealthError] {
val id: ShapeId = ShapeId("smithy4s.example", "Health")
@@ -321,13 +327,14 @@ object PizzaAdminServiceOperation {
}
sealed trait HealthError extends scala.Product with scala.Serializable {
@inline final def widen: HealthError = this
+ def _ordinal: Int
}
object HealthError extends ShapeTag.Companion[HealthError] {
val id: ShapeId = ShapeId("smithy4s.example", "HealthError")
val hints: Hints = Hints.empty
- final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends HealthError
+ final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends HealthError { final def _ordinal: Int = 0 }
def unknownServerError(unknownServerError:UnknownServerError): HealthError = UnknownServerErrorCase(unknownServerError)
object UnknownServerErrorCase {
@@ -339,12 +346,13 @@ object PizzaAdminServiceOperation {
implicit val schema: UnionSchema[HealthError] = union(
UnknownServerErrorCase.alt,
){
- case c: UnknownServerErrorCase => UnknownServerErrorCase.alt(c)
+ _._ordinal
}
}
final case class HeaderEndpoint(input: HeaderEndpointData) extends PizzaAdminServiceOperation[HeaderEndpointData, Nothing, HeaderEndpointData, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[HeaderEndpointData, Nothing, HeaderEndpointData, Nothing, Nothing] = impl.headerEndpoint(input.uppercaseHeader, input.capitalizedHeader, input.lowercaseHeader, input.mixedHeader)
- def endpoint: (HeaderEndpointData, smithy4s.Endpoint[PizzaAdminServiceOperation,HeaderEndpointData, Nothing, HeaderEndpointData, Nothing, Nothing]) = (input, HeaderEndpoint)
+ def ordinal = 4
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,HeaderEndpointData, Nothing, HeaderEndpointData, Nothing, Nothing] = HeaderEndpoint
}
object HeaderEndpoint extends smithy4s.Endpoint[PizzaAdminServiceOperation,HeaderEndpointData, Nothing, HeaderEndpointData, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "HeaderEndpoint")
@@ -360,7 +368,8 @@ object PizzaAdminServiceOperation {
}
final case class RoundTrip(input: RoundTripData) extends PizzaAdminServiceOperation[RoundTripData, Nothing, RoundTripData, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[RoundTripData, Nothing, RoundTripData, Nothing, Nothing] = impl.roundTrip(input.label, input.header, input.query, input.body)
- def endpoint: (RoundTripData, smithy4s.Endpoint[PizzaAdminServiceOperation,RoundTripData, Nothing, RoundTripData, Nothing, Nothing]) = (input, RoundTrip)
+ def ordinal = 5
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,RoundTripData, Nothing, RoundTripData, Nothing, Nothing] = RoundTrip
}
object RoundTrip extends smithy4s.Endpoint[PizzaAdminServiceOperation,RoundTripData, Nothing, RoundTripData, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "RoundTrip")
@@ -376,7 +385,8 @@ object PizzaAdminServiceOperation {
}
final case class GetEnum(input: GetEnumInput) extends PizzaAdminServiceOperation[GetEnumInput, PizzaAdminServiceOperation.GetEnumError, GetEnumOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[GetEnumInput, PizzaAdminServiceOperation.GetEnumError, GetEnumOutput, Nothing, Nothing] = impl.getEnum(input.aa)
- def endpoint: (GetEnumInput, smithy4s.Endpoint[PizzaAdminServiceOperation,GetEnumInput, PizzaAdminServiceOperation.GetEnumError, GetEnumOutput, Nothing, Nothing]) = (input, GetEnum)
+ def ordinal = 6
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,GetEnumInput, PizzaAdminServiceOperation.GetEnumError, GetEnumOutput, Nothing, Nothing] = GetEnum
}
object GetEnum extends smithy4s.Endpoint[PizzaAdminServiceOperation,GetEnumInput, PizzaAdminServiceOperation.GetEnumError, GetEnumOutput, Nothing, Nothing] with Errorable[GetEnumError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetEnum")
@@ -401,13 +411,14 @@ object PizzaAdminServiceOperation {
}
sealed trait GetEnumError extends scala.Product with scala.Serializable {
@inline final def widen: GetEnumError = this
+ def _ordinal: Int
}
object GetEnumError extends ShapeTag.Companion[GetEnumError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetEnumError")
val hints: Hints = Hints.empty
- final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends GetEnumError
+ final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends GetEnumError { final def _ordinal: Int = 0 }
def unknownServerError(unknownServerError:UnknownServerError): GetEnumError = UnknownServerErrorCase(unknownServerError)
object UnknownServerErrorCase {
@@ -419,12 +430,13 @@ object PizzaAdminServiceOperation {
implicit val schema: UnionSchema[GetEnumError] = union(
UnknownServerErrorCase.alt,
){
- case c: UnknownServerErrorCase => UnknownServerErrorCase.alt(c)
+ _._ordinal
}
}
final case class GetIntEnum(input: GetIntEnumInput) extends PizzaAdminServiceOperation[GetIntEnumInput, PizzaAdminServiceOperation.GetIntEnumError, GetIntEnumOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[GetIntEnumInput, PizzaAdminServiceOperation.GetIntEnumError, GetIntEnumOutput, Nothing, Nothing] = impl.getIntEnum(input.aa)
- def endpoint: (GetIntEnumInput, smithy4s.Endpoint[PizzaAdminServiceOperation,GetIntEnumInput, PizzaAdminServiceOperation.GetIntEnumError, GetIntEnumOutput, Nothing, Nothing]) = (input, GetIntEnum)
+ def ordinal = 7
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,GetIntEnumInput, PizzaAdminServiceOperation.GetIntEnumError, GetIntEnumOutput, Nothing, Nothing] = GetIntEnum
}
object GetIntEnum extends smithy4s.Endpoint[PizzaAdminServiceOperation,GetIntEnumInput, PizzaAdminServiceOperation.GetIntEnumError, GetIntEnumOutput, Nothing, Nothing] with Errorable[GetIntEnumError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetIntEnum")
@@ -449,13 +461,14 @@ object PizzaAdminServiceOperation {
}
sealed trait GetIntEnumError extends scala.Product with scala.Serializable {
@inline final def widen: GetIntEnumError = this
+ def _ordinal: Int
}
object GetIntEnumError extends ShapeTag.Companion[GetIntEnumError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetIntEnumError")
val hints: Hints = Hints.empty
- final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends GetIntEnumError
+ final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends GetIntEnumError { final def _ordinal: Int = 0 }
def unknownServerError(unknownServerError:UnknownServerError): GetIntEnumError = UnknownServerErrorCase(unknownServerError)
object UnknownServerErrorCase {
@@ -467,12 +480,13 @@ object PizzaAdminServiceOperation {
implicit val schema: UnionSchema[GetIntEnumError] = union(
UnknownServerErrorCase.alt,
){
- case c: UnknownServerErrorCase => UnknownServerErrorCase.alt(c)
+ _._ordinal
}
}
final case class CustomCode(input: CustomCodeInput) extends PizzaAdminServiceOperation[CustomCodeInput, PizzaAdminServiceOperation.CustomCodeError, CustomCodeOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[CustomCodeInput, PizzaAdminServiceOperation.CustomCodeError, CustomCodeOutput, Nothing, Nothing] = impl.customCode(input.code)
- def endpoint: (CustomCodeInput, smithy4s.Endpoint[PizzaAdminServiceOperation,CustomCodeInput, PizzaAdminServiceOperation.CustomCodeError, CustomCodeOutput, Nothing, Nothing]) = (input, CustomCode)
+ def ordinal = 8
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,CustomCodeInput, PizzaAdminServiceOperation.CustomCodeError, CustomCodeOutput, Nothing, Nothing] = CustomCode
}
object CustomCode extends smithy4s.Endpoint[PizzaAdminServiceOperation,CustomCodeInput, PizzaAdminServiceOperation.CustomCodeError, CustomCodeOutput, Nothing, Nothing] with Errorable[CustomCodeError] {
val id: ShapeId = ShapeId("smithy4s.example", "CustomCode")
@@ -497,13 +511,14 @@ object PizzaAdminServiceOperation {
}
sealed trait CustomCodeError extends scala.Product with scala.Serializable {
@inline final def widen: CustomCodeError = this
+ def _ordinal: Int
}
object CustomCodeError extends ShapeTag.Companion[CustomCodeError] {
val id: ShapeId = ShapeId("smithy4s.example", "CustomCodeError")
val hints: Hints = Hints.empty
- final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends CustomCodeError
+ final case class UnknownServerErrorCase(unknownServerError: UnknownServerError) extends CustomCodeError { final def _ordinal: Int = 0 }
def unknownServerError(unknownServerError:UnknownServerError): CustomCodeError = UnknownServerErrorCase(unknownServerError)
object UnknownServerErrorCase {
@@ -515,12 +530,13 @@ object PizzaAdminServiceOperation {
implicit val schema: UnionSchema[CustomCodeError] = union(
UnknownServerErrorCase.alt,
){
- case c: UnknownServerErrorCase => UnknownServerErrorCase.alt(c)
+ _._ordinal
}
}
final case class Reservation(input: ReservationInput) extends PizzaAdminServiceOperation[ReservationInput, Nothing, ReservationOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[ReservationInput, Nothing, ReservationOutput, Nothing, Nothing] = impl.reservation(input.name, input.town)
- def endpoint: (ReservationInput, smithy4s.Endpoint[PizzaAdminServiceOperation,ReservationInput, Nothing, ReservationOutput, Nothing, Nothing]) = (input, Reservation)
+ def ordinal = 9
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,ReservationInput, Nothing, ReservationOutput, Nothing, Nothing] = Reservation
}
object Reservation extends smithy4s.Endpoint[PizzaAdminServiceOperation,ReservationInput, Nothing, ReservationOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "Reservation")
@@ -536,7 +552,8 @@ object PizzaAdminServiceOperation {
}
final case class Echo(input: EchoInput) extends PizzaAdminServiceOperation[EchoInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[EchoInput, Nothing, Unit, Nothing, Nothing] = impl.echo(input.pathParam, input.body, input.queryParam)
- def endpoint: (EchoInput, smithy4s.Endpoint[PizzaAdminServiceOperation,EchoInput, Nothing, Unit, Nothing, Nothing]) = (input, Echo)
+ def ordinal = 10
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,EchoInput, Nothing, Unit, Nothing, Nothing] = Echo
}
object Echo extends smithy4s.Endpoint[PizzaAdminServiceOperation,EchoInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "Echo")
@@ -552,7 +569,9 @@ object PizzaAdminServiceOperation {
}
final case class OptionalOutput() extends PizzaAdminServiceOperation[Unit, Nothing, OptionalOutputOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: PizzaAdminServiceGen[F]): F[Unit, Nothing, OptionalOutputOutput, Nothing, Nothing] = impl.optionalOutput()
- def endpoint: (Unit, smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, OptionalOutputOutput, Nothing, Nothing]) = ((), OptionalOutput)
+ def ordinal = 11
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, OptionalOutputOutput, Nothing, Nothing] = OptionalOutput
}
object OptionalOutput extends smithy4s.Endpoint[PizzaAdminServiceOperation,Unit, Nothing, OptionalOutputOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "OptionalOutput")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala b/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala
index 4bad5fba8..a2c722369 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala
@@ -11,13 +11,16 @@ import smithy4s.schema.Schema.union
sealed trait Podcast extends PodcastCommon with scala.Product with scala.Serializable {
@inline final def widen: Podcast = this
+ def _ordinal: Int
}
object Podcast extends ShapeTag.Companion[Podcast] {
val id: ShapeId = ShapeId("smithy4s.example", "Podcast")
val hints: Hints = Hints.empty
- final case class Video(title: Option[String] = None, url: Option[String] = None, durationMillis: Option[Long] = None) extends Podcast
+ final case class Video(title: Option[String] = None, url: Option[String] = None, durationMillis: Option[Long] = None) extends Podcast {
+ def _ordinal: Int = 0
+ }
object Video extends ShapeTag.Companion[Video] {
val id: ShapeId = ShapeId("smithy4s.example", "Video")
@@ -33,7 +36,9 @@ object Podcast extends ShapeTag.Companion[Podcast] {
val alt = schema.oneOf[Podcast]("video")
}
- final case class Audio(title: Option[String] = None, url: Option[String] = None, durationMillis: Option[Long] = None) extends Podcast
+ final case class Audio(title: Option[String] = None, url: Option[String] = None, durationMillis: Option[Long] = None) extends Podcast {
+ def _ordinal: Int = 1
+ }
object Audio extends ShapeTag.Companion[Audio] {
val id: ShapeId = ShapeId("smithy4s.example", "Audio")
@@ -55,7 +60,6 @@ object Podcast extends ShapeTag.Companion[Podcast] {
Video.alt,
Audio.alt,
){
- case c: Video => Video.alt(c)
- case c: Audio => Audio.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInputService.scala b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInputService.scala
index 2b223864a..c82724608 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInputService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInputService.scala
@@ -35,11 +35,13 @@ object RecursiveInputServiceGen extends Service.Mixin[RecursiveInputServiceGen,
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[RecursiveInputServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[RecursiveInputServiceOperation, _, _, _, _, _]] = Vector(
RecursiveInputServiceOperation.RecursiveInputOperation,
)
- def endpoint[I, E, O, SI, SO](op: RecursiveInputServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: RecursiveInputServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: RecursiveInputServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: RecursiveInputServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends RecursiveInputServiceOperation.Transformed[RecursiveInputServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: RecursiveInputServiceGen[RecursiveInputServiceOperation] = RecursiveInputServiceOperation.reified
@@ -51,7 +53,9 @@ object RecursiveInputServiceGen extends Service.Mixin[RecursiveInputServiceGen,
sealed trait RecursiveInputServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: RecursiveInputServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[RecursiveInputServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[RecursiveInputServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object RecursiveInputServiceOperation {
@@ -68,7 +72,8 @@ object RecursiveInputServiceOperation {
}
final case class RecursiveInputOperation(input: RecursiveInput) extends RecursiveInputServiceOperation[RecursiveInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: RecursiveInputServiceGen[F]): F[RecursiveInput, Nothing, Unit, Nothing, Nothing] = impl.recursiveInputOperation(input.hello)
- def endpoint: (RecursiveInput, smithy4s.Endpoint[RecursiveInputServiceOperation,RecursiveInput, Nothing, Unit, Nothing, Nothing]) = (input, RecursiveInputOperation)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[RecursiveInputServiceOperation,RecursiveInput, Nothing, Unit, Nothing, Nothing] = RecursiveInputOperation
}
object RecursiveInputOperation extends smithy4s.Endpoint[RecursiveInputServiceOperation,RecursiveInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "RecursiveInputOperation")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/StreamedObjects.scala b/modules/bootstrapped/src/generated/smithy4s/example/StreamedObjects.scala
index f9c5180a8..eba62c19d 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/StreamedObjects.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/StreamedObjects.scala
@@ -34,12 +34,14 @@ object StreamedObjectsGen extends Service.Mixin[StreamedObjectsGen, StreamedObje
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[StreamedObjectsOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[StreamedObjectsOperation, _, _, _, _, _]] = Vector(
StreamedObjectsOperation.PutStreamedObject,
StreamedObjectsOperation.GetStreamedObject,
)
- def endpoint[I, E, O, SI, SO](op: StreamedObjectsOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: StreamedObjectsOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: StreamedObjectsOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: StreamedObjectsOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends StreamedObjectsOperation.Transformed[StreamedObjectsOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: StreamedObjectsGen[StreamedObjectsOperation] = StreamedObjectsOperation.reified
@@ -51,7 +53,9 @@ object StreamedObjectsGen extends Service.Mixin[StreamedObjectsGen, StreamedObje
sealed trait StreamedObjectsOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: StreamedObjectsGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[StreamedObjectsOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[StreamedObjectsOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object StreamedObjectsOperation {
@@ -70,7 +74,8 @@ object StreamedObjectsOperation {
}
final case class PutStreamedObject(input: PutStreamedObjectInput) extends StreamedObjectsOperation[PutStreamedObjectInput, Nothing, Unit, StreamedBlob, Nothing] {
def run[F[_, _, _, _, _]](impl: StreamedObjectsGen[F]): F[PutStreamedObjectInput, Nothing, Unit, StreamedBlob, Nothing] = impl.putStreamedObject(input.key)
- def endpoint: (PutStreamedObjectInput, smithy4s.Endpoint[StreamedObjectsOperation,PutStreamedObjectInput, Nothing, Unit, StreamedBlob, Nothing]) = (input, PutStreamedObject)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[StreamedObjectsOperation,PutStreamedObjectInput, Nothing, Unit, StreamedBlob, Nothing] = PutStreamedObject
}
object PutStreamedObject extends smithy4s.Endpoint[StreamedObjectsOperation,PutStreamedObjectInput, Nothing, Unit, StreamedBlob, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "PutStreamedObject")
@@ -84,7 +89,8 @@ object StreamedObjectsOperation {
}
final case class GetStreamedObject(input: GetStreamedObjectInput) extends StreamedObjectsOperation[GetStreamedObjectInput, Nothing, GetStreamedObjectOutput, Nothing, StreamedBlob] {
def run[F[_, _, _, _, _]](impl: StreamedObjectsGen[F]): F[GetStreamedObjectInput, Nothing, GetStreamedObjectOutput, Nothing, StreamedBlob] = impl.getStreamedObject(input.key)
- def endpoint: (GetStreamedObjectInput, smithy4s.Endpoint[StreamedObjectsOperation,GetStreamedObjectInput, Nothing, GetStreamedObjectOutput, Nothing, StreamedBlob]) = (input, GetStreamedObject)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[StreamedObjectsOperation,GetStreamedObjectInput, Nothing, GetStreamedObjectOutput, Nothing, StreamedBlob] = GetStreamedObject
}
object GetStreamedObject extends smithy4s.Endpoint[StreamedObjectsOperation,GetStreamedObjectInput, Nothing, GetStreamedObjectOutput, Nothing, StreamedBlob] {
val id: ShapeId = ShapeId("smithy4s.example", "GetStreamedObject")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala
index cc4702ee2..3a7e13e1c 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala
@@ -15,13 +15,16 @@ import smithy4s.schema.Schema.union
sealed trait TestAdt extends AdtMixinOne with AdtMixinTwo with scala.Product with scala.Serializable {
@inline final def widen: TestAdt = this
+ def _ordinal: Int
}
object TestAdt extends ShapeTag.Companion[TestAdt] {
val id: ShapeId = ShapeId("smithy4s.example", "TestAdt")
val hints: Hints = Hints.empty
- final case class AdtOne(lng: Option[Long] = None, sht: Option[Short] = None, blb: Option[ByteArray] = None, str: Option[String] = None) extends TestAdt with AdtMixinThree
+ final case class AdtOne(lng: Option[Long] = None, sht: Option[Short] = None, blb: Option[ByteArray] = None, str: Option[String] = None) extends TestAdt with AdtMixinThree {
+ def _ordinal: Int = 0
+ }
object AdtOne extends ShapeTag.Companion[AdtOne] {
val id: ShapeId = ShapeId("smithy4s.example", "AdtOne")
@@ -38,7 +41,9 @@ object TestAdt extends ShapeTag.Companion[TestAdt] {
val alt = schema.oneOf[TestAdt]("one")
}
- final case class AdtTwo(lng: Option[Long] = None, sht: Option[Short] = None, int: Option[Int] = None) extends TestAdt
+ final case class AdtTwo(lng: Option[Long] = None, sht: Option[Short] = None, int: Option[Int] = None) extends TestAdt {
+ def _ordinal: Int = 1
+ }
object AdtTwo extends ShapeTag.Companion[AdtTwo] {
val id: ShapeId = ShapeId("smithy4s.example", "AdtTwo")
@@ -60,7 +65,6 @@ object TestAdt extends ShapeTag.Companion[TestAdt] {
AdtOne.alt,
AdtTwo.alt,
){
- case c: AdtOne => AdtOne.alt(c)
- case c: AdtTwo => AdtTwo.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestBiggerUnion.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestBiggerUnion.scala
index b38f99e81..9a2d1952f 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/TestBiggerUnion.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/TestBiggerUnion.scala
@@ -9,6 +9,7 @@ import smithy4s.schema.Schema.union
sealed trait TestBiggerUnion extends scala.Product with scala.Serializable {
@inline final def widen: TestBiggerUnion = this
+ def _ordinal: Int
}
object TestBiggerUnion extends ShapeTag.Companion[TestBiggerUnion] {
val id: ShapeId = ShapeId("smithy4s.example", "TestBiggerUnion")
@@ -17,9 +18,9 @@ object TestBiggerUnion extends ShapeTag.Companion[TestBiggerUnion] {
alloy.Discriminated("tpe"),
)
- final case class OneCase(one: One) extends TestBiggerUnion
+ final case class OneCase(one: One) extends TestBiggerUnion { final def _ordinal: Int = 0 }
def one(one:One): TestBiggerUnion = OneCase(one)
- final case class TwoCase(two: Two) extends TestBiggerUnion
+ final case class TwoCase(two: Two) extends TestBiggerUnion { final def _ordinal: Int = 1 }
def two(two:Two): TestBiggerUnion = TwoCase(two)
object OneCase {
@@ -37,7 +38,6 @@ object TestBiggerUnion extends ShapeTag.Companion[TestBiggerUnion] {
OneCase.alt,
TwoCase.alt,
){
- case c: OneCase => OneCase.alt(c)
- case c: TwoCase => TwoCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala
index 1a009afd3..81bb21aff 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala
@@ -11,13 +11,16 @@ import smithy4s.schema.Schema.union
sealed trait TestMixinAdt extends scala.Product with scala.Serializable {
@inline final def widen: TestMixinAdt = this
+ def _ordinal: Int
}
object TestMixinAdt extends ShapeTag.Companion[TestMixinAdt] {
val id: ShapeId = ShapeId("smithy4s.example", "TestMixinAdt")
val hints: Hints = Hints.empty
- final case class TestAdtMemberWithMixin(a: Option[String] = None, b: Option[Int] = None) extends TestMixinAdt with CommonFieldsOne
+ final case class TestAdtMemberWithMixin(a: Option[String] = None, b: Option[Int] = None) extends TestMixinAdt with CommonFieldsOne {
+ def _ordinal: Int = 0
+ }
object TestAdtMemberWithMixin extends ShapeTag.Companion[TestAdtMemberWithMixin] {
val id: ShapeId = ShapeId("smithy4s.example", "TestAdtMemberWithMixin")
@@ -37,6 +40,6 @@ object TestMixinAdt extends ShapeTag.Companion[TestMixinAdt] {
implicit val schema: Schema[TestMixinAdt] = union(
TestAdtMemberWithMixin.alt,
){
- case c: TestAdtMemberWithMixin => TestAdtMemberWithMixin.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/UnionWithRefinedTypes.scala b/modules/bootstrapped/src/generated/smithy4s/example/UnionWithRefinedTypes.scala
index 22419870f..e4093dfe3 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/UnionWithRefinedTypes.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/UnionWithRefinedTypes.scala
@@ -9,15 +9,16 @@ import smithy4s.schema.Schema.union
sealed trait UnionWithRefinedTypes extends scala.Product with scala.Serializable {
@inline final def widen: UnionWithRefinedTypes = this
+ def _ordinal: Int
}
object UnionWithRefinedTypes extends ShapeTag.Companion[UnionWithRefinedTypes] {
val id: ShapeId = ShapeId("smithy4s.example", "UnionWithRefinedTypes")
val hints: Hints = Hints.empty
- final case class AgeCase(age: Age) extends UnionWithRefinedTypes
+ final case class AgeCase(age: Age) extends UnionWithRefinedTypes { final def _ordinal: Int = 0 }
def age(age:Age): UnionWithRefinedTypes = AgeCase(age)
- final case class DogNameCase(dogName: smithy4s.refined.Name) extends UnionWithRefinedTypes
+ final case class DogNameCase(dogName: smithy4s.refined.Name) extends UnionWithRefinedTypes { final def _ordinal: Int = 1 }
def dogName(dogName:smithy4s.refined.Name): UnionWithRefinedTypes = DogNameCase(dogName)
object AgeCase {
@@ -35,7 +36,6 @@ object UnionWithRefinedTypes extends ShapeTag.Companion[UnionWithRefinedTypes] {
AgeCase.alt,
DogNameCase.alt,
){
- case c: AgeCase => AgeCase.alt(c)
- case c: DogNameCase => DogNameCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/UntaggedUnion.scala b/modules/bootstrapped/src/generated/smithy4s/example/UntaggedUnion.scala
index 1eb06a310..642481506 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/UntaggedUnion.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/UntaggedUnion.scala
@@ -9,6 +9,7 @@ import smithy4s.schema.Schema.union
sealed trait UntaggedUnion extends scala.Product with scala.Serializable {
@inline final def widen: UntaggedUnion = this
+ def _ordinal: Int
}
object UntaggedUnion extends ShapeTag.Companion[UntaggedUnion] {
val id: ShapeId = ShapeId("smithy4s.example", "UntaggedUnion")
@@ -17,9 +18,9 @@ object UntaggedUnion extends ShapeTag.Companion[UntaggedUnion] {
alloy.Untagged(),
)
- final case class ThreeCase(three: Three) extends UntaggedUnion
+ final case class ThreeCase(three: Three) extends UntaggedUnion { final def _ordinal: Int = 0 }
def three(three:Three): UntaggedUnion = ThreeCase(three)
- final case class FourCase(four: Four) extends UntaggedUnion
+ final case class FourCase(four: Four) extends UntaggedUnion { final def _ordinal: Int = 1 }
def four(four:Four): UntaggedUnion = FourCase(four)
object ThreeCase {
@@ -37,7 +38,6 @@ object UntaggedUnion extends ShapeTag.Companion[UntaggedUnion] {
ThreeCase.alt,
FourCase.alt,
){
- case c: ThreeCase => ThreeCase.alt(c)
- case c: FourCase => FourCase.alt(c)
+ _._ordinal
}.withId(id).addHints(hints)
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Weather.scala b/modules/bootstrapped/src/generated/smithy4s/example/Weather.scala
index 8e6210d35..1650e9118 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/Weather.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/Weather.scala
@@ -45,14 +45,16 @@ object WeatherGen extends Service.Mixin[WeatherGen, WeatherOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[WeatherOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[WeatherOperation, _, _, _, _, _]] = Vector(
WeatherOperation.GetCurrentTime,
WeatherOperation.GetCity,
WeatherOperation.GetForecast,
WeatherOperation.ListCities,
)
- def endpoint[I, E, O, SI, SO](op: WeatherOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: WeatherOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: WeatherOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: WeatherOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends WeatherOperation.Transformed[WeatherOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: WeatherGen[WeatherOperation] = WeatherOperation.reified
@@ -66,7 +68,9 @@ object WeatherGen extends Service.Mixin[WeatherGen, WeatherOperation] {
sealed trait WeatherOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: WeatherGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[WeatherOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[WeatherOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object WeatherOperation {
@@ -89,7 +93,9 @@ object WeatherOperation {
}
final case class GetCurrentTime() extends WeatherOperation[Unit, Nothing, GetCurrentTimeOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: WeatherGen[F]): F[Unit, Nothing, GetCurrentTimeOutput, Nothing, Nothing] = impl.getCurrentTime()
- def endpoint: (Unit, smithy4s.Endpoint[WeatherOperation,Unit, Nothing, GetCurrentTimeOutput, Nothing, Nothing]) = ((), GetCurrentTime)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[WeatherOperation,Unit, Nothing, GetCurrentTimeOutput, Nothing, Nothing] = GetCurrentTime
}
object GetCurrentTime extends smithy4s.Endpoint[WeatherOperation,Unit, Nothing, GetCurrentTimeOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "GetCurrentTime")
@@ -105,7 +111,8 @@ object WeatherOperation {
}
final case class GetCity(input: GetCityInput) extends WeatherOperation[GetCityInput, WeatherOperation.GetCityError, GetCityOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: WeatherGen[F]): F[GetCityInput, WeatherOperation.GetCityError, GetCityOutput, Nothing, Nothing] = impl.getCity(input.cityId)
- def endpoint: (GetCityInput, smithy4s.Endpoint[WeatherOperation,GetCityInput, WeatherOperation.GetCityError, GetCityOutput, Nothing, Nothing]) = (input, GetCity)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[WeatherOperation,GetCityInput, WeatherOperation.GetCityError, GetCityOutput, Nothing, Nothing] = GetCity
}
object GetCity extends smithy4s.Endpoint[WeatherOperation,GetCityInput, WeatherOperation.GetCityError, GetCityOutput, Nothing, Nothing] with Errorable[GetCityError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetCity")
@@ -129,13 +136,14 @@ object WeatherOperation {
}
sealed trait GetCityError extends scala.Product with scala.Serializable {
@inline final def widen: GetCityError = this
+ def _ordinal: Int
}
object GetCityError extends ShapeTag.Companion[GetCityError] {
val id: ShapeId = ShapeId("smithy4s.example", "GetCityError")
val hints: Hints = Hints.empty
- final case class NoSuchResourceCase(noSuchResource: NoSuchResource) extends GetCityError
+ final case class NoSuchResourceCase(noSuchResource: NoSuchResource) extends GetCityError { final def _ordinal: Int = 0 }
def noSuchResource(noSuchResource:NoSuchResource): GetCityError = NoSuchResourceCase(noSuchResource)
object NoSuchResourceCase {
@@ -147,12 +155,13 @@ object WeatherOperation {
implicit val schema: UnionSchema[GetCityError] = union(
NoSuchResourceCase.alt,
){
- case c: NoSuchResourceCase => NoSuchResourceCase.alt(c)
+ _._ordinal
}
}
final case class GetForecast(input: GetForecastInput) extends WeatherOperation[GetForecastInput, Nothing, GetForecastOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: WeatherGen[F]): F[GetForecastInput, Nothing, GetForecastOutput, Nothing, Nothing] = impl.getForecast(input.cityId)
- def endpoint: (GetForecastInput, smithy4s.Endpoint[WeatherOperation,GetForecastInput, Nothing, GetForecastOutput, Nothing, Nothing]) = (input, GetForecast)
+ def ordinal = 2
+ def endpoint: smithy4s.Endpoint[WeatherOperation,GetForecastInput, Nothing, GetForecastOutput, Nothing, Nothing] = GetForecast
}
object GetForecast extends smithy4s.Endpoint[WeatherOperation,GetForecastInput, Nothing, GetForecastOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "GetForecast")
@@ -168,7 +177,8 @@ object WeatherOperation {
}
final case class ListCities(input: ListCitiesInput) extends WeatherOperation[ListCitiesInput, Nothing, ListCitiesOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: WeatherGen[F]): F[ListCitiesInput, Nothing, ListCitiesOutput, Nothing, Nothing] = impl.listCities(input.nextToken, input.pageSize)
- def endpoint: (ListCitiesInput, smithy4s.Endpoint[WeatherOperation,ListCitiesInput, Nothing, ListCitiesOutput, Nothing, Nothing]) = (input, ListCities)
+ def ordinal = 3
+ def endpoint: smithy4s.Endpoint[WeatherOperation,ListCitiesInput, Nothing, ListCitiesOutput, Nothing, Nothing] = ListCities
}
object ListCities extends smithy4s.Endpoint[WeatherOperation,ListCitiesInput, Nothing, ListCitiesOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example", "ListCities")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/aws/MyThing.scala b/modules/bootstrapped/src/generated/smithy4s/example/aws/MyThing.scala
index aa372f664..7ef4adbc6 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/aws/MyThing.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/aws/MyThing.scala
@@ -31,9 +31,11 @@ object MyThingGen extends Service.Mixin[MyThingGen, MyThingOperation] {
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[MyThingOperation, _, _, _, _, _]] = List()
+ val endpoints: Vector[smithy4s.Endpoint[MyThingOperation, _, _, _, _, _]] = Vector()
- def endpoint[I, E, O, SI, SO](op: MyThingOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: MyThingOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: MyThingOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: MyThingOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends MyThingOperation.Transformed[MyThingOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: MyThingGen[MyThingOperation] = MyThingOperation.reified
@@ -45,7 +47,9 @@ object MyThingGen extends Service.Mixin[MyThingGen, MyThingOperation] {
sealed trait MyThingOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: MyThingGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[MyThingOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[MyThingOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object MyThingOperation {
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedNameService.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedNameService.scala
index e13cb6a0f..73f5f62d4 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedNameService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedNameService.scala
@@ -38,14 +38,16 @@ object ReservedNameServiceGen extends Service.Mixin[ReservedNameServiceGen, Rese
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: scala.List[smithy4s.Endpoint[ReservedNameServiceOperation, _, _, _, _, _]] = scala.List(
+ val endpoints: Vector[smithy4s.Endpoint[ReservedNameServiceOperation, _, _, _, _, _]] = Vector(
ReservedNameServiceOperation.Set,
ReservedNameServiceOperation.List,
ReservedNameServiceOperation.Map,
ReservedNameServiceOperation.Option,
)
- def endpoint[I, E, O, SI, SO](op: ReservedNameServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ReservedNameServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ReservedNameServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ReservedNameServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ReservedNameServiceOperation.Transformed[ReservedNameServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ReservedNameServiceGen[ReservedNameServiceOperation] = ReservedNameServiceOperation.reified
@@ -57,7 +59,9 @@ object ReservedNameServiceGen extends Service.Mixin[ReservedNameServiceGen, Rese
sealed trait ReservedNameServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ReservedNameServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ReservedNameServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ReservedNameServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ReservedNameServiceOperation {
@@ -80,7 +84,8 @@ object ReservedNameServiceOperation {
}
final case class Set(input: SetInput) extends ReservedNameServiceOperation[SetInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ReservedNameServiceGen[F]): F[SetInput, Nothing, Unit, Nothing, Nothing] = impl.set(input.set)
- def endpoint: (SetInput, smithy4s.Endpoint[ReservedNameServiceOperation,SetInput, Nothing, Unit, Nothing, Nothing]) = (input, Set)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[ReservedNameServiceOperation,SetInput, Nothing, Unit, Nothing, Nothing] = Set
}
object Set extends smithy4s.Endpoint[ReservedNameServiceOperation,SetInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.collision", "Set")
@@ -96,7 +101,8 @@ object ReservedNameServiceOperation {
}
final case class List(input: ListInput) extends ReservedNameServiceOperation[ListInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ReservedNameServiceGen[F]): F[ListInput, Nothing, Unit, Nothing, Nothing] = impl.list(input.list)
- def endpoint: (ListInput, smithy4s.Endpoint[ReservedNameServiceOperation,ListInput, Nothing, Unit, Nothing, Nothing]) = (input, List)
+ def ordinal = 1
+ def endpoint: smithy4s.Endpoint[ReservedNameServiceOperation,ListInput, Nothing, Unit, Nothing, Nothing] = List
}
object List extends smithy4s.Endpoint[ReservedNameServiceOperation,ListInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.collision", "List")
@@ -112,7 +118,8 @@ object ReservedNameServiceOperation {
}
final case class Map(input: MapInput) extends ReservedNameServiceOperation[MapInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ReservedNameServiceGen[F]): F[MapInput, Nothing, Unit, Nothing, Nothing] = impl.map(input.value)
- def endpoint: (MapInput, smithy4s.Endpoint[ReservedNameServiceOperation,MapInput, Nothing, Unit, Nothing, Nothing]) = (input, Map)
+ def ordinal = 2
+ def endpoint: smithy4s.Endpoint[ReservedNameServiceOperation,MapInput, Nothing, Unit, Nothing, Nothing] = Map
}
object Map extends smithy4s.Endpoint[ReservedNameServiceOperation,MapInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.collision", "Map")
@@ -128,7 +135,8 @@ object ReservedNameServiceOperation {
}
final case class Option(input: OptionInput) extends ReservedNameServiceOperation[OptionInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ReservedNameServiceGen[F]): F[OptionInput, Nothing, Unit, Nothing, Nothing] = impl.option(input.value)
- def endpoint: (OptionInput, smithy4s.Endpoint[ReservedNameServiceOperation,OptionInput, Nothing, Unit, Nothing, Nothing]) = (input, Option)
+ def ordinal = 3
+ def endpoint: smithy4s.Endpoint[ReservedNameServiceOperation,OptionInput, Nothing, Unit, Nothing, Nothing] = Option
}
object Option extends smithy4s.Endpoint[ReservedNameServiceOperation,OptionInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.collision", "Option")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetService.scala b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetService.scala
index fa78f74e2..915adeb66 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetService.scala
@@ -32,11 +32,13 @@ object GreetServiceGen extends Service.Mixin[GreetServiceGen, GreetServiceOperat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[GreetServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[GreetServiceOperation, _, _, _, _, _]] = Vector(
GreetServiceOperation.Greet,
)
- def endpoint[I, E, O, SI, SO](op: GreetServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: GreetServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: GreetServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: GreetServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends GreetServiceOperation.Transformed[GreetServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: GreetServiceGen[GreetServiceOperation] = GreetServiceOperation.reified
@@ -48,7 +50,9 @@ object GreetServiceGen extends Service.Mixin[GreetServiceGen, GreetServiceOperat
sealed trait GreetServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: GreetServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[GreetServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[GreetServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object GreetServiceOperation {
@@ -65,7 +69,8 @@ object GreetServiceOperation {
}
final case class Greet(input: GreetInput) extends GreetServiceOperation[GreetInput, Nothing, GreetOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: GreetServiceGen[F]): F[GreetInput, Nothing, GreetOutput, Nothing, Nothing] = impl.greet(input.name)
- def endpoint: (GreetInput, smithy4s.Endpoint[GreetServiceOperation,GreetInput, Nothing, GreetOutput, Nothing, Nothing]) = (input, Greet)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[GreetServiceOperation,GreetInput, Nothing, GreetOutput, Nothing, Nothing] = Greet
}
object Greet extends smithy4s.Endpoint[GreetServiceOperation,GreetInput, Nothing, GreetOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.greet", "Greet")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HelloWorldAuthService.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HelloWorldAuthService.scala
index 194c7cb8e..b01d202b5 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HelloWorldAuthService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HelloWorldAuthService.scala
@@ -42,12 +42,14 @@ object HelloWorldAuthServiceGen extends Service.Mixin[HelloWorldAuthServiceGen,
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[HelloWorldAuthServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[HelloWorldAuthServiceOperation, _, _, _, _, _]] = Vector(
HelloWorldAuthServiceOperation.SayWorld,
HelloWorldAuthServiceOperation.HealthCheck,
)
- def endpoint[I, E, O, SI, SO](op: HelloWorldAuthServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: HelloWorldAuthServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: HelloWorldAuthServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: HelloWorldAuthServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends HelloWorldAuthServiceOperation.Transformed[HelloWorldAuthServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: HelloWorldAuthServiceGen[HelloWorldAuthServiceOperation] = HelloWorldAuthServiceOperation.reified
@@ -63,7 +65,9 @@ object HelloWorldAuthServiceGen extends Service.Mixin[HelloWorldAuthServiceGen,
sealed trait HelloWorldAuthServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: HelloWorldAuthServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[HelloWorldAuthServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[HelloWorldAuthServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object HelloWorldAuthServiceOperation {
@@ -82,7 +86,9 @@ object HelloWorldAuthServiceOperation {
}
final case class SayWorld() extends HelloWorldAuthServiceOperation[Unit, HelloWorldAuthServiceOperation.SayWorldError, World, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloWorldAuthServiceGen[F]): F[Unit, HelloWorldAuthServiceOperation.SayWorldError, World, Nothing, Nothing] = impl.sayWorld()
- def endpoint: (Unit, smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.SayWorldError, World, Nothing, Nothing]) = ((), SayWorld)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.SayWorldError, World, Nothing, Nothing] = SayWorld
}
object SayWorld extends smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.SayWorldError, World, Nothing, Nothing] with Errorable[SayWorldError] {
val id: ShapeId = ShapeId("smithy4s.example.guides.auth", "SayWorld")
@@ -107,13 +113,14 @@ object HelloWorldAuthServiceOperation {
}
sealed trait SayWorldError extends scala.Product with scala.Serializable {
@inline final def widen: SayWorldError = this
+ def _ordinal: Int
}
object SayWorldError extends ShapeTag.Companion[SayWorldError] {
val id: ShapeId = ShapeId("smithy4s.example.guides.auth", "SayWorldError")
val hints: Hints = Hints.empty
- final case class NotAuthorizedErrorCase(notAuthorizedError: NotAuthorizedError) extends SayWorldError
+ final case class NotAuthorizedErrorCase(notAuthorizedError: NotAuthorizedError) extends SayWorldError { final def _ordinal: Int = 0 }
def notAuthorizedError(notAuthorizedError:NotAuthorizedError): SayWorldError = NotAuthorizedErrorCase(notAuthorizedError)
object NotAuthorizedErrorCase {
@@ -125,12 +132,14 @@ object HelloWorldAuthServiceOperation {
implicit val schema: UnionSchema[SayWorldError] = union(
NotAuthorizedErrorCase.alt,
){
- case c: NotAuthorizedErrorCase => NotAuthorizedErrorCase.alt(c)
+ _._ordinal
}
}
final case class HealthCheck() extends HelloWorldAuthServiceOperation[Unit, HelloWorldAuthServiceOperation.HealthCheckError, HealthCheckOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloWorldAuthServiceGen[F]): F[Unit, HelloWorldAuthServiceOperation.HealthCheckError, HealthCheckOutput, Nothing, Nothing] = impl.healthCheck()
- def endpoint: (Unit, smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.HealthCheckError, HealthCheckOutput, Nothing, Nothing]) = ((), HealthCheck)
+ def ordinal = 1
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.HealthCheckError, HealthCheckOutput, Nothing, Nothing] = HealthCheck
}
object HealthCheck extends smithy4s.Endpoint[HelloWorldAuthServiceOperation,Unit, HelloWorldAuthServiceOperation.HealthCheckError, HealthCheckOutput, Nothing, Nothing] with Errorable[HealthCheckError] {
val id: ShapeId = ShapeId("smithy4s.example.guides.auth", "HealthCheck")
@@ -156,13 +165,14 @@ object HelloWorldAuthServiceOperation {
}
sealed trait HealthCheckError extends scala.Product with scala.Serializable {
@inline final def widen: HealthCheckError = this
+ def _ordinal: Int
}
object HealthCheckError extends ShapeTag.Companion[HealthCheckError] {
val id: ShapeId = ShapeId("smithy4s.example.guides.auth", "HealthCheckError")
val hints: Hints = Hints.empty
- final case class NotAuthorizedErrorCase(notAuthorizedError: NotAuthorizedError) extends HealthCheckError
+ final case class NotAuthorizedErrorCase(notAuthorizedError: NotAuthorizedError) extends HealthCheckError { final def _ordinal: Int = 0 }
def notAuthorizedError(notAuthorizedError:NotAuthorizedError): HealthCheckError = NotAuthorizedErrorCase(notAuthorizedError)
object NotAuthorizedErrorCase {
@@ -174,7 +184,7 @@ object HelloWorldAuthServiceOperation {
implicit val schema: UnionSchema[HealthCheckError] = union(
NotAuthorizedErrorCase.alt,
){
- case c: NotAuthorizedErrorCase => NotAuthorizedErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/HelloWorldService.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/HelloWorldService.scala
index 81c2280f2..5e44ae7ce 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/HelloWorldService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/HelloWorldService.scala
@@ -36,11 +36,13 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = Vector(
HelloWorldServiceOperation.SayWorld,
)
- def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends HelloWorldServiceOperation.Transformed[HelloWorldServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: HelloWorldServiceGen[HelloWorldServiceOperation] = HelloWorldServiceOperation.reified
@@ -52,7 +54,9 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
sealed trait HelloWorldServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object HelloWorldServiceOperation {
@@ -69,7 +73,9 @@ object HelloWorldServiceOperation {
}
final case class SayWorld() extends HelloWorldServiceOperation[Unit, Nothing, World, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[Unit, Nothing, World, Nothing, Nothing] = impl.sayWorld()
- def endpoint: (Unit, smithy4s.Endpoint[HelloWorldServiceOperation,Unit, Nothing, World, Nothing, Nothing]) = ((), SayWorld)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[HelloWorldServiceOperation,Unit, Nothing, World, Nothing, Nothing] = SayWorld
}
object SayWorld extends smithy4s.Endpoint[HelloWorldServiceOperation,Unit, Nothing, World, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.guides.hello", "SayWorld")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/hello/HelloWorldService.scala b/modules/bootstrapped/src/generated/smithy4s/example/hello/HelloWorldService.scala
index a007d482c..ab0971f9a 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/hello/HelloWorldService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/hello/HelloWorldService.scala
@@ -40,11 +40,13 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = Vector(
HelloWorldServiceOperation.Hello,
)
- def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends HelloWorldServiceOperation.Transformed[HelloWorldServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: HelloWorldServiceGen[HelloWorldServiceOperation] = HelloWorldServiceOperation.reified
@@ -58,7 +60,9 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
sealed trait HelloWorldServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object HelloWorldServiceOperation {
@@ -75,7 +79,8 @@ object HelloWorldServiceOperation {
}
final case class Hello(input: Person) extends HelloWorldServiceOperation[Person, HelloWorldServiceOperation.HelloError, Greeting, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[Person, HelloWorldServiceOperation.HelloError, Greeting, Nothing, Nothing] = impl.hello(input.name, input.town)
- def endpoint: (Person, smithy4s.Endpoint[HelloWorldServiceOperation,Person, HelloWorldServiceOperation.HelloError, Greeting, Nothing, Nothing]) = (input, Hello)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[HelloWorldServiceOperation,Person, HelloWorldServiceOperation.HelloError, Greeting, Nothing, Nothing] = Hello
}
object Hello extends smithy4s.Endpoint[HelloWorldServiceOperation,Person, HelloWorldServiceOperation.HelloError, Greeting, Nothing, Nothing] with Errorable[HelloError] {
val id: ShapeId = ShapeId("smithy4s.example.hello", "Hello")
@@ -102,15 +107,16 @@ object HelloWorldServiceOperation {
}
sealed trait HelloError extends scala.Product with scala.Serializable {
@inline final def widen: HelloError = this
+ def _ordinal: Int
}
object HelloError extends ShapeTag.Companion[HelloError] {
val id: ShapeId = ShapeId("smithy4s.example.hello", "HelloError")
val hints: Hints = Hints.empty
- final case class GenericServerErrorCase(genericServerError: GenericServerError) extends HelloError
+ final case class GenericServerErrorCase(genericServerError: GenericServerError) extends HelloError { final def _ordinal: Int = 0 }
def genericServerError(genericServerError:GenericServerError): HelloError = GenericServerErrorCase(genericServerError)
- final case class SpecificServerErrorCase(specificServerError: SpecificServerError) extends HelloError
+ final case class SpecificServerErrorCase(specificServerError: SpecificServerError) extends HelloError { final def _ordinal: Int = 1 }
def specificServerError(specificServerError:SpecificServerError): HelloError = SpecificServerErrorCase(specificServerError)
object GenericServerErrorCase {
@@ -128,8 +134,7 @@ object HelloWorldServiceOperation {
GenericServerErrorCase.alt,
SpecificServerErrorCase.alt,
){
- case c: GenericServerErrorCase => GenericServerErrorCase.alt(c)
- case c: SpecificServerErrorCase => SpecificServerErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/imp/ImportService.scala b/modules/bootstrapped/src/generated/smithy4s/example/imp/ImportService.scala
index 55a1ad0a7..825d92d73 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/imp/ImportService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/imp/ImportService.scala
@@ -42,11 +42,13 @@ object ImportServiceGen extends Service.Mixin[ImportServiceGen, ImportServiceOpe
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[ImportServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[ImportServiceOperation, _, _, _, _, _]] = Vector(
ImportServiceOperation.ImportOperation,
)
- def endpoint[I, E, O, SI, SO](op: ImportServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ImportServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ImportServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ImportServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ImportServiceOperation.Transformed[ImportServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ImportServiceGen[ImportServiceOperation] = ImportServiceOperation.reified
@@ -60,7 +62,9 @@ object ImportServiceGen extends Service.Mixin[ImportServiceGen, ImportServiceOpe
sealed trait ImportServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ImportServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ImportServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ImportServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ImportServiceOperation {
@@ -77,7 +81,9 @@ object ImportServiceOperation {
}
final case class ImportOperation() extends ImportServiceOperation[Unit, ImportServiceOperation.ImportOperationError, OpOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ImportServiceGen[F]): F[Unit, ImportServiceOperation.ImportOperationError, OpOutput, Nothing, Nothing] = impl.importOperation()
- def endpoint: (Unit, smithy4s.Endpoint[ImportServiceOperation,Unit, ImportServiceOperation.ImportOperationError, OpOutput, Nothing, Nothing]) = ((), ImportOperation)
+ def ordinal = 0
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[ImportServiceOperation,Unit, ImportServiceOperation.ImportOperationError, OpOutput, Nothing, Nothing] = ImportOperation
}
object ImportOperation extends smithy4s.Endpoint[ImportServiceOperation,Unit, ImportServiceOperation.ImportOperationError, OpOutput, Nothing, Nothing] with Errorable[ImportOperationError] {
val id: ShapeId = ShapeId("smithy4s.example.import_test", "ImportOperation")
@@ -101,13 +107,14 @@ object ImportServiceOperation {
}
sealed trait ImportOperationError extends scala.Product with scala.Serializable {
@inline final def widen: ImportOperationError = this
+ def _ordinal: Int
}
object ImportOperationError extends ShapeTag.Companion[ImportOperationError] {
val id: ShapeId = ShapeId("smithy4s.example.imp", "ImportOperationError")
val hints: Hints = Hints.empty
- final case class NotFoundErrorCase(notFoundError: NotFoundError) extends ImportOperationError
+ final case class NotFoundErrorCase(notFoundError: NotFoundError) extends ImportOperationError { final def _ordinal: Int = 0 }
def notFoundError(notFoundError:NotFoundError): ImportOperationError = NotFoundErrorCase(notFoundError)
object NotFoundErrorCase {
@@ -119,7 +126,7 @@ object ImportServiceOperation {
implicit val schema: UnionSchema[ImportOperationError] = union(
NotFoundErrorCase.alt,
){
- case c: NotFoundErrorCase => NotFoundErrorCase.alt(c)
+ _._ordinal
}
}
}
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleService.scala b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleService.scala
index 90da11301..40203056e 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleService.scala
@@ -39,11 +39,13 @@ object ExampleServiceGen extends Service.Mixin[ExampleServiceGen, ExampleService
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[ExampleServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[ExampleServiceOperation, _, _, _, _, _]] = Vector(
ExampleServiceOperation.ExampleOperation,
)
- def endpoint[I, E, O, SI, SO](op: ExampleServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: ExampleServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: ExampleServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: ExampleServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ExampleServiceOperation.Transformed[ExampleServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: ExampleServiceGen[ExampleServiceOperation] = ExampleServiceOperation.reified
@@ -79,7 +81,9 @@ object ExampleServiceProductGen extends ServiceProduct[ExampleServiceProductGen]
sealed trait ExampleServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: ExampleServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[ExampleServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[ExampleServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object ExampleServiceOperation {
@@ -96,7 +100,8 @@ object ExampleServiceOperation {
}
final case class ExampleOperation(input: ExampleOperationInput) extends ExampleServiceOperation[ExampleOperationInput, Nothing, ExampleOperationOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: ExampleServiceGen[F]): F[ExampleOperationInput, Nothing, ExampleOperationOutput, Nothing, Nothing] = impl.exampleOperation(input.a)
- def endpoint: (ExampleOperationInput, smithy4s.Endpoint[ExampleServiceOperation,ExampleOperationInput, Nothing, ExampleOperationOutput, Nothing, Nothing]) = (input, ExampleOperation)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[ExampleServiceOperation,ExampleOperationInput, Nothing, ExampleOperationOutput, Nothing, Nothing] = ExampleOperation
}
object ExampleOperation extends smithy4s.Endpoint[ExampleServiceOperation,ExampleOperationInput, Nothing, ExampleOperationOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.product", "ExampleOperation")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloService.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloService.scala
index c22a8abb9..bc75415ea 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloService.scala
@@ -42,13 +42,15 @@ object HelloServiceGen extends Service.Mixin[HelloServiceGen, HelloServiceOperat
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[HelloServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[HelloServiceOperation, _, _, _, _, _]] = Vector(
HelloServiceOperation.SayHello,
HelloServiceOperation.Listen,
HelloServiceOperation.TestPath,
)
- def endpoint[I, E, O, SI, SO](op: HelloServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: HelloServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: HelloServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: HelloServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends HelloServiceOperation.Transformed[HelloServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: HelloServiceGen[HelloServiceOperation] = HelloServiceOperation.reified
@@ -62,7 +64,9 @@ object HelloServiceGen extends Service.Mixin[HelloServiceGen, HelloServiceOperat
sealed trait HelloServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: HelloServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[HelloServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[HelloServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object HelloServiceOperation {
@@ -83,7 +87,8 @@ object HelloServiceOperation {
}
final case class SayHello(input: SayHelloInput) extends HelloServiceOperation[SayHelloInput, HelloServiceOperation.SayHelloError, SayHelloOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloServiceGen[F]): F[SayHelloInput, HelloServiceOperation.SayHelloError, SayHelloOutput, Nothing, Nothing] = impl.sayHello(input.greeting, input.query, input.name)
- def endpoint: (SayHelloInput, smithy4s.Endpoint[HelloServiceOperation,SayHelloInput, HelloServiceOperation.SayHelloError, SayHelloOutput, Nothing, Nothing]) = (input, SayHello)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[HelloServiceOperation,SayHelloInput, HelloServiceOperation.SayHelloError, SayHelloOutput, Nothing, Nothing] = SayHello
}
object SayHello extends smithy4s.Endpoint[HelloServiceOperation,SayHelloInput, HelloServiceOperation.SayHelloError, SayHelloOutput, Nothing, Nothing] with Errorable[SayHelloError] {
val id: ShapeId = ShapeId("smithy4s.example.test", "SayHello")
@@ -111,15 +116,16 @@ object HelloServiceOperation {
}
sealed trait SayHelloError extends scala.Product with scala.Serializable {
@inline final def widen: SayHelloError = this
+ def _ordinal: Int
}
object SayHelloError extends ShapeTag.Companion[SayHelloError] {
val id: ShapeId = ShapeId("smithy4s.example.test", "SayHelloError")
val hints: Hints = Hints.empty
- final case class SimpleErrorCase(simpleError: SimpleError) extends SayHelloError
+ final case class SimpleErrorCase(simpleError: SimpleError) extends SayHelloError { final def _ordinal: Int = 0 }
def simpleError(simpleError:SimpleError): SayHelloError = SimpleErrorCase(simpleError)
- final case class ComplexErrorCase(complexError: ComplexError) extends SayHelloError
+ final case class ComplexErrorCase(complexError: ComplexError) extends SayHelloError { final def _ordinal: Int = 1 }
def complexError(complexError:ComplexError): SayHelloError = ComplexErrorCase(complexError)
object SimpleErrorCase {
@@ -137,13 +143,14 @@ object HelloServiceOperation {
SimpleErrorCase.alt,
ComplexErrorCase.alt,
){
- case c: SimpleErrorCase => SimpleErrorCase.alt(c)
- case c: ComplexErrorCase => ComplexErrorCase.alt(c)
+ _._ordinal
}
}
final case class Listen() extends HelloServiceOperation[Unit, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloServiceGen[F]): F[Unit, Nothing, Unit, Nothing, Nothing] = impl.listen()
- def endpoint: (Unit, smithy4s.Endpoint[HelloServiceOperation,Unit, Nothing, Unit, Nothing, Nothing]) = ((), Listen)
+ def ordinal = 1
+ def input: Unit = ()
+ def endpoint: smithy4s.Endpoint[HelloServiceOperation,Unit, Nothing, Unit, Nothing, Nothing] = Listen
}
object Listen extends smithy4s.Endpoint[HelloServiceOperation,Unit, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.test", "Listen")
@@ -161,7 +168,8 @@ object HelloServiceOperation {
}
final case class TestPath(input: TestPathInput) extends HelloServiceOperation[TestPathInput, Nothing, Unit, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloServiceGen[F]): F[TestPathInput, Nothing, Unit, Nothing, Nothing] = impl.testPath(input.path)
- def endpoint: (TestPathInput, smithy4s.Endpoint[HelloServiceOperation,TestPathInput, Nothing, Unit, Nothing, Nothing]) = (input, TestPath)
+ def ordinal = 2
+ def endpoint: smithy4s.Endpoint[HelloServiceOperation,TestPathInput, Nothing, Unit, Nothing, Nothing] = TestPath
}
object TestPath extends smithy4s.Endpoint[HelloServiceOperation,TestPathInput, Nothing, Unit, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.test", "TestPath")
diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloWorldService.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloWorldService.scala
index c3af04aaa..e8f197b76 100644
--- a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloWorldService.scala
+++ b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloWorldService.scala
@@ -34,11 +34,13 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[HelloWorldServiceOperation, _, _, _, _, _]] = Vector(
HelloWorldServiceOperation.Hello,
)
- def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: HelloWorldServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends HelloWorldServiceOperation.Transformed[HelloWorldServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: HelloWorldServiceGen[HelloWorldServiceOperation] = HelloWorldServiceOperation.reified
@@ -50,7 +52,9 @@ object HelloWorldServiceGen extends Service.Mixin[HelloWorldServiceGen, HelloWor
sealed trait HelloWorldServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[HelloWorldServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object HelloWorldServiceOperation {
@@ -67,7 +71,8 @@ object HelloWorldServiceOperation {
}
final case class Hello(input: HelloInput) extends HelloWorldServiceOperation[HelloInput, Nothing, HelloOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: HelloWorldServiceGen[F]): F[HelloInput, Nothing, HelloOutput, Nothing, Nothing] = impl.hello(input.name)
- def endpoint: (HelloInput, smithy4s.Endpoint[HelloWorldServiceOperation,HelloInput, Nothing, HelloOutput, Nothing, Nothing]) = (input, Hello)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[HelloWorldServiceOperation,HelloInput, Nothing, HelloOutput, Nothing, Nothing] = Hello
}
object Hello extends smithy4s.Endpoint[HelloWorldServiceOperation,HelloInput, Nothing, HelloOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("smithy4s.example.test", "Hello")
diff --git a/modules/bootstrapped/src/generated/weather/WeatherService.scala b/modules/bootstrapped/src/generated/weather/WeatherService.scala
index e8352b988..43e5b3af4 100644
--- a/modules/bootstrapped/src/generated/weather/WeatherService.scala
+++ b/modules/bootstrapped/src/generated/weather/WeatherService.scala
@@ -34,11 +34,13 @@ object WeatherServiceGen extends Service.Mixin[WeatherServiceGen, WeatherService
type Default[F[+_, +_]] = Constant[smithy4s.kinds.stubs.Kind2[F]#toKind5]
}
- val endpoints: List[smithy4s.Endpoint[WeatherServiceOperation, _, _, _, _, _]] = List(
+ val endpoints: Vector[smithy4s.Endpoint[WeatherServiceOperation, _, _, _, _, _]] = Vector(
WeatherServiceOperation.GetWeather,
)
- def endpoint[I, E, O, SI, SO](op: WeatherServiceOperation[I, E, O, SI, SO]) = op.endpoint
+ def input[I, E, O, SI, SO](op: WeatherServiceOperation[I, E, O, SI, SO]): I = op.input
+ def ordinal[I, E, O, SI, SO](op: WeatherServiceOperation[I, E, O, SI, SO]): Int = op.ordinal
+ override def endpoint[I, E, O, SI, SO](op: WeatherServiceOperation[I, E, O, SI, SO]) = op.endpoint
class Constant[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends WeatherServiceOperation.Transformed[WeatherServiceOperation, P](reified, const5(value))
type Default[F[+_]] = Constant[smithy4s.kinds.stubs.Kind1[F]#toKind5]
def reified: WeatherServiceGen[WeatherServiceOperation] = WeatherServiceOperation.reified
@@ -50,7 +52,9 @@ object WeatherServiceGen extends Service.Mixin[WeatherServiceGen, WeatherService
sealed trait WeatherServiceOperation[Input, Err, Output, StreamedInput, StreamedOutput] {
def run[F[_, _, _, _, _]](impl: WeatherServiceGen[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]
- def endpoint: (Input, Endpoint[WeatherServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput])
+ def ordinal: Int
+ def input: Input
+ def endpoint: Endpoint[WeatherServiceOperation, Input, Err, Output, StreamedInput, StreamedOutput]
}
object WeatherServiceOperation {
@@ -67,7 +71,8 @@ object WeatherServiceOperation {
}
final case class GetWeather(input: GetWeatherInput) extends WeatherServiceOperation[GetWeatherInput, Nothing, GetWeatherOutput, Nothing, Nothing] {
def run[F[_, _, _, _, _]](impl: WeatherServiceGen[F]): F[GetWeatherInput, Nothing, GetWeatherOutput, Nothing, Nothing] = impl.getWeather(input.city)
- def endpoint: (GetWeatherInput, smithy4s.Endpoint[WeatherServiceOperation,GetWeatherInput, Nothing, GetWeatherOutput, Nothing, Nothing]) = (input, GetWeather)
+ def ordinal = 0
+ def endpoint: smithy4s.Endpoint[WeatherServiceOperation,GetWeatherInput, Nothing, GetWeatherOutput, Nothing, Nothing] = GetWeather
}
object GetWeather extends smithy4s.Endpoint[WeatherServiceOperation,GetWeatherInput, Nothing, GetWeatherOutput, Nothing, Nothing] {
val id: ShapeId = ShapeId("weather", "GetWeather")
diff --git a/modules/bootstrapped/test/src/smithy4s/CachedSchemaVisitorSpec.scala b/modules/bootstrapped/test/src/smithy4s/CachedSchemaVisitorSpec.scala
index 5dd5c7129..fb45c66cb 100644
--- a/modules/bootstrapped/test/src/smithy4s/CachedSchemaVisitorSpec.scala
+++ b/modules/bootstrapped/test/src/smithy4s/CachedSchemaVisitorSpec.scala
@@ -190,14 +190,7 @@ class CachedSchemaVisitorSpec() extends FunSuite {
}
test(header + "union") {
- type Foo = Either[Int, String]
- val left = int.oneOf[Foo]("left", Left(_))
- val right = string.oneOf[Foo]("right", Right(_))
- val schema = union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
-
+ val schema = Schema.either(int, string)
checkSchema(schema)
}
diff --git a/modules/bootstrapped/test/src/smithy4s/DocumentSpec.scala b/modules/bootstrapped/test/src/smithy4s/DocumentSpec.scala
index 04f2d349d..e6fc23869 100644
--- a/modules/bootstrapped/test/src/smithy4s/DocumentSpec.scala
+++ b/modules/bootstrapped/test/src/smithy4s/DocumentSpec.scala
@@ -18,8 +18,8 @@ package smithy4s
import smithy.api.JsonName
import smithy.api.Default
-import alloy.Discriminated
import smithy4s.example.IntList
+import alloy.Discriminated
import munit._
class DocumentSpec() extends FunSuite {
@@ -45,64 +45,45 @@ class DocumentSpec() extends FunSuite {
}
import smithy4s.schema.Schema._
- implicit val tupleIntStringSchema: Schema[(Int, String)] = {
- val i = int.required[(Int, String)]("int", _._1)
- val s =
- string
- .required[(Int, String)]("string", _._2)
- .addHints(JsonName("_string"))
- struct(i, s)((_, _))
- }
+ implicit val tupleIntStringSchema: Schema[(Int, String)] =
+ Schema.tuple(
+ int.addMemberHints(JsonName("int")),
+ string.addMemberHints(JsonName("_string"))
+ )
- implicit val eitherIntStringSchema: Schema[Either[Int, String]] = {
- val left = int.oneOf[Either[Int, String]]("int", (int: Int) => Left(int))
- val right =
- string
- .oneOf[Either[Int, String]]("string", (str: String) => Right(str))
- .addHints(JsonName("_string"))
- union(left, right) {
- case Left(i) => left(i)
- case Right(str) => right(str)
- }
- }
+ implicit val eitherIntStringSchema: Schema[Either[Int, String]] =
+ Schema.either(int, string.addMemberHints(JsonName("_string")))
case class Foo(str: String)
case class Bar(str: String, int: Int)
implicit val eitherFooBarSchema: Schema[Either[Foo, Bar]] = {
val left = struct(string.required[Foo]("str", _.str))(Foo.apply)
- .oneOf[Either[Foo, Bar]]("foo", (f: Foo) => Left(f))
-
val right = struct(
string.required[Bar]("str", _.str).addHints(JsonName("barStr")),
int.required[Bar]("int", _.int)
)(Bar.apply)
- .oneOf[Either[Foo, Bar]]("bar", (b: Bar) => Right(b))
- .addHints(JsonName("barBar"))
-
- union(left, right) {
- case Left(f) => left(f)
- case Right(b) => right(b)
- }.addHints(
- Discriminated("type")
- )
+ .addMemberHints(JsonName("barBar"))
+
+ Schema
+ .either(left, right)
+ .addHints(
+ Discriminated("type")
+ )
}
case class Baz()
implicit val eitherFooBazSchema: Schema[Either[Foo, Baz]] = {
val left = struct(string.required[Foo]("str", _.str))(Foo.apply)
- .oneOf[Either[Foo, Baz]]("foo", (f: Foo) => Left(f))
val right = constant(Baz())
- .oneOf[Either[Foo, Baz]]("baz", (b: Baz) => Right(b))
- union(left, right) {
- case Left(f) => left(f)
- case Right(b) => right(b)
- }.addHints(
- Discriminated("type")
- )
+ Schema
+ .either(left, right)
+ .addHints(
+ Discriminated("type")
+ )
}
test("jsonName is handled correctly on structures") {
@@ -118,8 +99,8 @@ class DocumentSpec() extends FunSuite {
val roundTripped = Document.decode[(Int, String)](document)
- expect(document == expectedDocument)
- expect(roundTripped == Right(intAndString))
+ expect.same(document, expectedDocument)
+ expect.same(roundTripped, Right(intAndString))
}
test("jsonName is handled correctly on unions") {
@@ -163,7 +144,7 @@ class DocumentSpec() extends FunSuite {
import Document._
val expectedDocument =
obj(
- "type" -> fromString("baz")
+ "type" -> fromString("right")
)
val roundTripped = Document.decode[Either[Foo, Baz]](document)
diff --git a/modules/bootstrapped/test/src/smithy4s/schema/AltSpec.scala b/modules/bootstrapped/test/src/smithy4s/schema/AltSpec.scala
deleted file mode 100644
index 00221ba6d..000000000
--- a/modules/bootstrapped/test/src/smithy4s/schema/AltSpec.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2021-2022 Disney Streaming
- *
- * Licensed under the Tomorrow Open Source Technology License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://disneystreaming.github.io/TOST-1.0.txt
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package smithy4s
-package schema
-
-import Schema._
-import munit._
-
-final class AltSpec extends FunSuite {
-
- test("dispatcher projector") {
- type Foo = Either[Int, String]
- val left = int.oneOf[Foo]("left", Left(_))
- val right = string.oneOf[Foo]("right", Right(_))
- val schema = union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
-
- val dispatcher = Alt.Dispatcher.fromUnion(schema)
-
- val projectedLeft = dispatcher.projector[Int](left)
-
- val projectedRight = dispatcher.projector[String](right)
-
- assertEquals(projectedLeft(Left(100)), Option(100))
- assertEquals(projectedLeft(Right("100")), None)
- assertEquals(projectedRight(Right("100")), Option("100"))
- assertEquals(projectedRight(Left(100)), None)
- }
-
-}
diff --git a/modules/bootstrapped/test/src/smithy4s/schema/DefaultValueSpec.scala b/modules/bootstrapped/test/src/smithy4s/schema/DefaultValueSpec.scala
index 33dea5c82..8f8275f4c 100644
--- a/modules/bootstrapped/test/src/smithy4s/schema/DefaultValueSpec.scala
+++ b/modules/bootstrapped/test/src/smithy4s/schema/DefaultValueSpec.scala
@@ -99,12 +99,7 @@ final class DefaultValueSpec extends FunSuite {
test("union") {
type Foo = Either[Int, String]
- val left = Schema.int.oneOf[Foo]("left", Left(_))
- val right = Schema.string.oneOf[Foo]("right", Right(_))
- val u: Schema[Foo] = Schema.union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
+ val u: Schema[Foo] = Schema.either(Schema.int, Schema.string)
testCaseOpt(u, None)
}
diff --git a/modules/bootstrapped/test/src/smithy4s/schema/HintsTransformationSpec.scala b/modules/bootstrapped/test/src/smithy4s/schema/HintsTransformationSpec.scala
index feccbc12b..1f9bd230a 100644
--- a/modules/bootstrapped/test/src/smithy4s/schema/HintsTransformationSpec.scala
+++ b/modules/bootstrapped/test/src/smithy4s/schema/HintsTransformationSpec.scala
@@ -100,12 +100,7 @@ class HintsTransformationSpec() extends FunSuite {
test(header("union")) {
type Foo = Either[Int, String]
- val left = int.oneOf[Foo]("left", Left(_))
- val right = string.oneOf[Foo]("right", Right(_))
- implicit val schema: Schema[Foo] = union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }
+ implicit val schema: Schema[Foo] = Schema.either(int, string)
// One for the union, one for the union member
checkSchema(Left(1): Foo, 2)
diff --git a/modules/cats/src/smithy4s/interopcats/SchemaVisitorHash.scala b/modules/cats/src/smithy4s/interopcats/SchemaVisitorHash.scala
index c784e1545..7a9cd3609 100644
--- a/modules/cats/src/smithy4s/interopcats/SchemaVisitorHash.scala
+++ b/modules/cats/src/smithy4s/interopcats/SchemaVisitorHash.scala
@@ -149,10 +149,9 @@ final class SchemaVisitorHash(
// We're using it to get a function that lets us project the `U` against `A`.
// `U` is not necessarily an `A, so this function returns an `Option`
- val projectA: U => Option[A] = dispatch.projector(altA)
val hashA = instance.compile(self)
new AltHash[A] {
- def eqv(a: A, u: U): Boolean = projectA(u) match {
+ def eqv(a: A, u: U): Boolean = altA.project.lift(u) match {
case None => false // U is not an A.
case Some(a2) =>
hashA.eqv(a, a2) // U is an A, we delegate the comparison
diff --git a/modules/cats/test/src/testcases/IntOrInt.scala b/modules/cats/test/src/testcases/IntOrInt.scala
index c2020cb85..9c4db2418 100644
--- a/modules/cats/test/src/testcases/IntOrInt.scala
+++ b/modules/cats/test/src/testcases/IntOrInt.scala
@@ -26,12 +26,13 @@ object IntOrInt {
case class IntValue1(value: Int) extends IntOrInt
val schema: Schema[IntOrInt] = {
- val intValue0 = int.oneOf[IntOrInt]("intValue0", IntValue0(_))
- val intValue1 = int.oneOf[IntOrInt]("intValue1", IntValue1(_))
- union(intValue0, intValue1) {
- case IntValue0(value) => intValue0(value)
- case IntValue1(value) => intValue1(value)
+ val intValue0 = int.oneOf[IntOrInt]("intValue0", IntValue0(_)) {
+ case IntValue0(int) => int
}
+ val intValue1 = int.oneOf[IntOrInt]("intValue1", IntValue1(_)) {
+ case IntValue1(int) => int
+ }
+ union(intValue0, intValue1).reflective
}.withId(ShapeId("", "IntOrInt"))
}
diff --git a/modules/cats/test/src/testcases/IntOrString.scala b/modules/cats/test/src/testcases/IntOrString.scala
index fc9928af5..dc675d8a6 100644
--- a/modules/cats/test/src/testcases/IntOrString.scala
+++ b/modules/cats/test/src/testcases/IntOrString.scala
@@ -28,11 +28,12 @@ object IntOrString {
case class StringValue(value: String) extends IntOrString
val schema: Schema[IntOrString] = {
- val intValue = int.oneOf[IntOrString]("intValue", IntValue(_))
- val stringValue = string.oneOf[IntOrString]("stringValue", StringValue(_))
- union(intValue, stringValue) {
- case IntValue(int) => intValue(int)
- case StringValue(string) => stringValue(string)
- }.withId(ShapeId("", "IntOrString"))
+ val intValue = int.oneOf[IntOrString]("intValue", IntValue(_)) {
+ case IntValue(int) => int
+ }
+ val stringValue = string.oneOf[IntOrString]("stringValue", StringValue(_)) {
+ case StringValue(str) => str
+ }
+ union(intValue, stringValue).reflective.withId(ShapeId("", "IntOrString"))
}
}
diff --git a/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala b/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala
index 508485ac9..be53cdf70 100644
--- a/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala
+++ b/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala
@@ -290,6 +290,8 @@ private[internals] object CollisionAvoidance {
val bijection_ = NameRef("smithy4s.schema.Schema", "bijection")
val Transformed_ = NameDef("Transformed")
val endpoint_ = NameDef("endpoint")
+ val input_ = NameDef("input")
+ val ordinal_ = NameDef("ordinal")
val mapK5_ = NameDef("mapK5")
val fromPolyFunction_ = NameDef("fromPolyFunction")
val toPolyFunction_ = NameDef("toPolyFunction")
@@ -319,8 +321,10 @@ private[internals] object CollisionAvoidance {
val document_ = NameRef("smithy4s", "Document")
val uuid_ = NameRef("smithy4s", "UUID")
val list = NameRef("scala", "List")
+ val indexedSeq = NameRef("scala.collection.immutable", "IndexedSeq")
val set = NameRef("scala.collection.immutable", "Set")
val map = NameRef("scala.collection.immutable", "Map")
+ val vector = NameRef("scala", "Vector")
val option = NameRef("scala", "Option")
val none = NameRef("scala", "None")
val some = NameRef("scala", "Some")
diff --git a/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala b/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala
index 14dcc125b..1f23f34be 100644
--- a/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala
+++ b/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala
@@ -353,10 +353,12 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
line"type $Default_[F[+_, +_]] = $Constant_[smithy4s.kinds.stubs.Kind2[F]#toKind5]"
),
newline,
- line"val endpoints: $list[smithy4s.Endpoint[$opTraitName, $wildcardArgument, $wildcardArgument, $wildcardArgument, $wildcardArgument, $wildcardArgument]] = $list"
+ line"val endpoints: $vector[smithy4s.Endpoint[$opTraitName, $wildcardArgument, $wildcardArgument, $wildcardArgument, $wildcardArgument, $wildcardArgument]] = $vector"
.args(ops.map(op => line"${opTraitNameRef}.${op.name}")),
newline,
- line"def $endpoint_[I, E, O, SI, SO](op: $opTraitNameRef[I, E, O, SI, SO]) = op.$endpoint_",
+ line"def $input_[I, E, O, SI, SO](op: $opTraitNameRef[I, E, O, SI, SO]): I = op.$input_",
+ line"def $ordinal_[I, E, O, SI, SO](op: $opTraitNameRef[I, E, O, SI, SO]): Int = op.$ordinal_",
+ line"override def $endpoint_[I, E, O, SI, SO](op: $opTraitNameRef[I, E, O, SI, SO]) = op.$endpoint_",
line"class $Constant_[P[-_, +_, +_, +_, +_]](value: P[Any, Nothing, Nothing, Nothing, Nothing]) extends ${opTraitNameRef}.$Transformed_[$opTraitNameRef, P](reified, $const5_(value))",
line"type $Default_[F[+_]] = $Constant_[smithy4s.kinds.stubs.Kind1[F]#toKind5]",
line"def reified: $genNameRef[$opTraitNameRef] = ${opTraitNameRef}.${NameRef("reified")}",
@@ -431,7 +433,9 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
line"sealed trait $opTraitName[Input, Err, Output, StreamedInput, StreamedOutput]"
)(
line"def run[F[_, _, _, _, _]](impl: $genName[F]): F[Input, Err, Output, StreamedInput, StreamedOutput]",
- line"def endpoint: (Input, $Endpoint_[$opTraitName, Input, Err, Output, StreamedInput, StreamedOutput])"
+ line"def ordinal: Int",
+ line"def input: Input",
+ line"def endpoint: $Endpoint_[$opTraitName, Input, Err, Output, StreamedInput, StreamedOutput]"
),
newline,
block(
@@ -469,7 +473,9 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
line"def $apply_[I, E, O, SI, SO](op: $opTraitNameRef[I, E, O, SI, SO]): P[I, E, O, SI, SO] = op.run(impl) "
}
),
- ops.map(renderOperation(name, _))
+ ops.zipWithIndex.map { case (op, ordinal) =>
+ renderOperation(name, op, ordinal)
+ }
),
newline
)
@@ -477,14 +483,12 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
private def renderOperation(
serviceName: String,
- op: Operation
+ op: Operation,
+ ordinal: Int
): Lines = {
val params = if (op.input != Type.unit) {
line"input: ${op.input}"
} else Line.empty
- val inputRef = if (op.input != Type.unit) {
- line"input"
- } else line"()"
val genServiceName = serviceName + "Gen"
val opObjectName = serviceName + "Operation"
val opName = op.name
@@ -541,8 +545,10 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
)(
line"def run[F[_, _, _, _, _]](impl: $genServiceName[F]): F[${op
.renderAlgParams(opObjectName)}] = impl.${op.methodName}(${op.renderAccessedParams})",
- line"def endpoint: (${op.input}, smithy4s.Endpoint[$traitName,${op
- .renderAlgParams(opObjectName)}]) = ($inputRef, $opNameRef)"
+ line"def ordinal = $ordinal",
+ if (op.input == Type.unit) line"def input: Unit = ()" else Lines.empty,
+ line"def endpoint: smithy4s.Endpoint[$traitName,${op
+ .renderAlgParams(opObjectName)}] = $opNameRef"
),
obj(
opNameRef,
@@ -611,7 +617,8 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
private def renderProductNonMixin(
product: Product,
adtParent: Option[NameRef],
- additionalLines: Lines
+ additionalLines: Lines,
+ classBody: Lines
): Lines = {
import product._
val renderedArgs = renderArgs(fields)
@@ -643,7 +650,12 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
val ext =
if (extend.nonEmpty) line" extends $extend"
else Line.empty
- line"$decl$ext"
+
+ if (classBody.isEmpty) line"$decl$ext"
+ else
+ block(line"$decl$ext") {
+ classBody
+ }
},
obj(product.nameRef, shapeTag(product.nameRef))(
renderId(shapeId),
@@ -725,7 +737,8 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
private def renderProduct(
product: Product,
adtParent: Option[NameRef] = None,
- additionalLines: Lines = Lines.empty
+ additionalLines: Lines = Lines.empty,
+ classBody: Lines = Lines.empty
): Lines = {
import product._
val base =
@@ -739,7 +752,8 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
renderProductNonMixin(
product,
adtParent,
- additionalLines
+ additionalLines,
+ classBody
)
lines(
@@ -831,8 +845,8 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
block(
line"$union_(${members.map { case (n, _) => altVal(n) }.intercalate(line", ")})"
)(
- members.map { case (altName, _) =>
- line"case c: $altName => ${altVal(altName)}(c)"
+ members.zipWithIndex.map { case ((altName, _), index) =>
+ line"case _: $altName => $index"
}
)
)
@@ -883,35 +897,42 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
block(
line"sealed trait ${NameDef(name.name)} extends ${mixinExtendsStatement}scala.Product with scala.Serializable"
)(
- line"@inline final def widen: $name = this"
+ line"@inline final def widen: $name = this",
+ line"def _ordinal: Int"
),
obj(name, line"${shapeTag(name)}")(
renderId(shapeId),
newline,
renderHintsVal(hints),
newline,
- alts.map {
- case a @ Alt(_, realName, UnionMember.UnitCase, altHints) =>
+ alts.zipWithIndex.map {
+ case (a @ Alt(_, realName, UnionMember.UnitCase, altHints), index) =>
val cn = caseName(a)
// format: off
lines(
documentationAnnotation(altHints),
deprecationAnnotation(altHints),
- line"case object $cn extends $name",
+ line"case object $cn extends $name { final def _ordinal: Int = $index }",
smartConstructor(a),
+
line"""private val ${cn}Alt = $Schema_.constant($cn)${renderConstraintValidation(altHints)}.oneOf[$name]("$realName").addHints(hints)""",
- line"private val ${cn}AltWithValue = ${cn}Alt($cn)"
)
- // format: on
- case a @ Alt(altName, _, UnionMember.TypeCase(tpe), altHints) =>
+ // format: on
+ case (
+ a @ Alt(altName, _, UnionMember.TypeCase(tpe), altHints),
+ index
+ ) =>
val cn = caseName(a)
lines(
documentationAnnotation(altHints),
deprecationAnnotation(altHints),
- line"final case class $cn(${uncapitalise(altName)}: $tpe) extends $name",
+ line"final case class $cn(${uncapitalise(altName)}: $tpe) extends $name { final def _ordinal: Int = $index }",
smartConstructor(a)
)
- case Alt(_, realName, UnionMember.ProductCase(struct), altHints) =>
+ case (
+ Alt(_, realName, UnionMember.ProductCase(struct), altHints),
+ index
+ ) =>
val additionalLines = lines(
newline,
line"""val alt = schema.oneOf[$name]("$realName")"""
@@ -923,7 +944,8 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
// might need deduplication (although the Hints type will take care of it, just in case)
struct.copy(hints = altHints ++ struct.hints),
adtParent = Some(name),
- additionalLines
+ additionalLines,
+ classBody = Lines(line"def _ordinal: Int = $index")
)
},
newline,
@@ -959,12 +981,7 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self =>
}
}
.block {
- caseNamesAndIsUnit.map {
- case (caseName, true) =>
- line"case $caseName => ${caseName}AltWithValue"
- case (caseName, false) =>
- line"case c: $caseName => $caseName.alt(c)"
- }
+ line"_._ordinal"
}
.appendToLast(
if (error) "" else ".withId(id).addHints(hints)"
diff --git a/modules/codegen/src/smithy4s/codegen/internals/ToLines.scala b/modules/codegen/src/smithy4s/codegen/internals/ToLines.scala
index c0b314d8a..acdf5d0af 100644
--- a/modules/codegen/src/smithy4s/codegen/internals/ToLines.scala
+++ b/modules/codegen/src/smithy4s/codegen/internals/ToLines.scala
@@ -56,6 +56,8 @@ private[internals] object ToLines {
// Models
private[internals] case class Lines(list: List[Line]) {
+ def isEmpty: Boolean = list.isEmpty
+
def block(l: LinesWithValue*): Lines = {
val openBlock: List[Line] =
list.lastOption.flatMap(_.segments.lastOption).collect {
diff --git a/modules/codegen/test/src/smithy4s/codegen/internals/RendererConfigSpec.scala b/modules/codegen/test/src/smithy4s/codegen/internals/RendererConfigSpec.scala
index 307cbbb65..a9870bee8 100644
--- a/modules/codegen/test/src/smithy4s/codegen/internals/RendererConfigSpec.scala
+++ b/modules/codegen/test/src/smithy4s/codegen/internals/RendererConfigSpec.scala
@@ -151,8 +151,8 @@ final class RendererConfigSpec extends munit.FunSuite {
| val badRequestAlt = BadRequest.schema.oneOf[OperationError]("BadRequest")
| val internalServerErrorAlt = InternalServerError.schema.oneOf[OperationError]("InternalServerError")
| union(badRequestAlt, internalServerErrorAlt) {
- | case c: BadRequest => badRequestAlt(c)
- | case c: InternalServerError => internalServerErrorAlt(c)
+ | case _: BadRequest => 0
+ | case _: InternalServerError => 1
| }
| }
|}""".stripMargin
@@ -183,7 +183,7 @@ final class RendererConfigSpec extends munit.FunSuite {
val serviceCode = generateScalaCode(smithy)("smithy4s.Service")
assertContainsSection(serviceCode, "val endpoints")(
- """val endpoints: List[smithy4s.Endpoint[ServiceOperation, ?, ?, ?, ?, ?]] = List(
+ """val endpoints: Vector[smithy4s.Endpoint[ServiceOperation, ?, ?, ?, ?, ?]] = Vector(
| ServiceOperation.Operation,
|)""".stripMargin
)
@@ -210,7 +210,7 @@ final class RendererConfigSpec extends munit.FunSuite {
val serviceCode = generateScalaCode(smithy)("smithy4s.Service")
assertContainsSection(serviceCode, "val endpoints")(
- """val endpoints: List[smithy4s.Endpoint[ServiceOperation, _, _, _, _, _]] = List(
+ """val endpoints: Vector[smithy4s.Endpoint[ServiceOperation, _, _, _, _, _]] = Vector(
| ServiceOperation.Operation,
|)""".stripMargin
)
@@ -245,6 +245,7 @@ final class RendererConfigSpec extends munit.FunSuite {
assertContainsSection(serviceCode, "sealed trait OperationError")(
"""|sealed trait OperationError extends scala.Product with scala.Serializable {
| @inline final def widen: OperationError = this
+ | def _ordinal: Int
|}""".stripMargin
)
@@ -252,9 +253,9 @@ final class RendererConfigSpec extends munit.FunSuite {
"""|object OperationError extends ShapeTag.Companion[OperationError] {
| val id: ShapeId = ShapeId("smithy4s.errors", "OperationError")
| val hints: Hints = Hints.empty
- | final case class BadRequestCase(badRequest: BadRequest) extends OperationError
+ | final case class BadRequestCase(badRequest: BadRequest) extends OperationError { final def _ordinal: Int = 0 }
| def badRequest(badRequest:BadRequest): OperationError = BadRequestCase(badRequest)
- | final case class InternalServerErrorCase(internalServerError: InternalServerError) extends OperationError
+ | final case class InternalServerErrorCase(internalServerError: InternalServerError) extends OperationError { final def _ordinal: Int = 1 }
| def internalServerError(internalServerError:InternalServerError): OperationError = InternalServerErrorCase(internalServerError)
| object BadRequestCase {
| val hints: Hints = Hints.empty
@@ -270,8 +271,7 @@ final class RendererConfigSpec extends munit.FunSuite {
| BadRequestCase.alt,
| InternalServerErrorCase.alt,
| ){
- | case c: BadRequestCase => BadRequestCase.alt(c)
- | case c: InternalServerErrorCase => InternalServerErrorCase.alt(c)
+ | _._ordinal
| }
|}""".stripMargin
)
diff --git a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ClientHttpComplianceTestCase.scala b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ClientHttpComplianceTestCase.scala
index 70093d594..9ed5bacbf 100644
--- a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ClientHttpComplianceTestCase.scala
+++ b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ClientHttpComplianceTestCase.scala
@@ -33,7 +33,6 @@ import smithy4s.Service
import cats.Eq
import smithy4s.compliancetests.TestConfig._
import scala.concurrent.duration._
-import smithy4s.schema.Alt
import smithy4s.http.HttpContractError
private[compliancetests] class ClientHttpComplianceTestCase[
@@ -243,18 +242,18 @@ private[compliancetests] class ClientHttpComplianceTestCase[
endpoint,
tc,
errorSchema = Some(
- ErrorResponseTest.from(
- errorAlt,
- Alt.Dispatcher.fromUnion(errorable.error),
- errorable
- )
+ ErrorResponseTest
+ .from(
+ errorAlt,
+ errorable
+ )
)
)
}
}
}
}
- service.endpoints.flatMap { case endpoint =>
+ service.endpoints.toList.flatMap { case endpoint =>
val requestTests = endpoint.hints
.get(HttpRequestTests)
.map(_.value)
diff --git a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ErrorResponseTest.scala b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ErrorResponseTest.scala
index ea1ba1cd6..29a59edce 100644
--- a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ErrorResponseTest.scala
+++ b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ErrorResponseTest.scala
@@ -25,7 +25,6 @@ import cats.kernel.Eq
import cats.syntax.all._
import smithy4s.compliancetests.internals.eq.EqSchemaVisitor
import smithy4s.compliancetests.ComplianceTest.ComplianceResult
-import smithy4s.schema.Alt.Dispatcher
private[compliancetests] final case class ErrorResponseTest[A, E](
schema: Schema[A],
@@ -75,13 +74,12 @@ private[compliancetests] final case class ErrorResponseTest[A, E](
private[compliancetests] object ErrorResponseTest {
def from[E, A](
errorAlt: smithy4s.schema.Alt[E, A],
- dispatcher: Dispatcher[E],
errorable: smithy4s.Errorable[E]
): ErrorResponseTest[A, E] =
ErrorResponseTest(
errorAlt.schema,
errorAlt.inject,
- dispatcher.projector(errorAlt),
+ errorAlt.project.lift,
errorable
)
}
diff --git a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ServerHttpComplianceTestCase.scala b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ServerHttpComplianceTestCase.scala
index 189d6799d..0de36408f 100644
--- a/modules/compliance-tests/src/smithy4s/compliancetests/internals/ServerHttpComplianceTestCase.scala
+++ b/modules/compliance-tests/src/smithy4s/compliancetests/internals/ServerHttpComplianceTestCase.scala
@@ -26,7 +26,6 @@ import org.http4s.headers.`Content-Type`
import smithy.test._
import smithy4s.{Document, Errorable, Hints, Service, ShapeId}
import smithy4s.kinds._
-import smithy4s.schema.Alt
import scala.concurrent.duration._
import smithy4s.compliancetests.internals.eq.EqSchemaVisitor
@@ -110,8 +109,8 @@ private[compliancetests] class ServerHttpComplianceTestCase[
def apply[I_, E_, O_, SE_, SO_](
op: originalService.Operation[I_, E_, O_, SE_, SO_]
): F[O_] = {
- val (in, endpointInternal) = originalService.endpoint(op)
-
+ val endpointInternal = originalService.endpoint(op)
+ val in = originalService.input(op)
if (endpointInternal.id == endpoint.id)
inputDeferred.complete(in.asInstanceOf[I]) *>
raiseError(new IntendedShortCircuit)
@@ -272,8 +271,9 @@ private[compliancetests] class ServerHttpComplianceTestCase[
// format: off
new Service.Reflective[NoInputOp] {
override def id: ShapeId = ShapeId("custom", "service")
- override def endpoints: List[Endpoint[_, _, _, _, _]] = List(amendedEndpoint)
- override def endpoint[I_, E_, O_, SI_, SO_](op: NoInputOp[I_, E_, O_, SI_, SO_]): (I_, Endpoint[I_, E_, O_, SI_, SO_]) = ???
+ override def endpoints: Vector[Endpoint[_, _, _, _, _]] = Vector(amendedEndpoint)
+ override def input[I_, E_, O_, SI_, SO_](op: NoInputOp[I_, E_, O_, SI_, SO_]) : I_ = ???
+ override def ordinal[I_, E_, O_, SI_, SO_](op: NoInputOp[I_, E_, O_, SI_, SO_]): Int = ???
override def version: String = originalService.version
override def hints: Hints = originalService.hints
}
@@ -302,7 +302,6 @@ private[compliancetests] class ServerHttpComplianceTestCase[
ErrorResponseTest
.from(
errorAlt,
- Alt.Dispatcher.fromUnion(errorable.error),
errorable
)
)
@@ -311,7 +310,7 @@ private[compliancetests] class ServerHttpComplianceTestCase[
}
}
}
- originalService.endpoints.flatMap { case endpoint =>
+ originalService.endpoints.toList.flatMap { case endpoint =>
val requestsTests = endpoint.hints
.get(HttpRequestTests)
.map(_.value)
diff --git a/modules/compliance-tests/src/smithy4s/compliancetests/internals/eq/EqSchemaVisitor.scala b/modules/compliance-tests/src/smithy4s/compliancetests/internals/eq/EqSchemaVisitor.scala
index b26e1e3f6..285460705 100644
--- a/modules/compliance-tests/src/smithy4s/compliancetests/internals/eq/EqSchemaVisitor.scala
+++ b/modules/compliance-tests/src/smithy4s/compliancetests/internals/eq/EqSchemaVisitor.scala
@@ -111,10 +111,9 @@ object EqSchemaVisitor extends SchemaVisitor[Eq] { self =>
alternatives.find(_.label == label).get.asInstanceOf[Alt[U, A]]
// We're using it to get a function that lets us project the `U` against `A`.
// `U` is not necessarily an `A, so this function returns an `Option`
- val projectA: U => Option[A] = dispatch.projector(altA)
val eqA = instance.compile(self)
new AltEq[A] {
- def eqv(a: A, u: U): Boolean = projectA(u) match {
+ def eqv(a: A, u: U): Boolean = altA.project.lift(u) match {
case None => false // U is not an A.
case Some(a2) =>
eqA.eqv(a, a2) // U is an A, we delegate the comparison
diff --git a/modules/compliance-tests/test/src/EqVisitorSpec.scala b/modules/compliance-tests/test/src/EqVisitorSpec.scala
index d8519b5c0..37df6a29d 100644
--- a/modules/compliance-tests/test/src/EqVisitorSpec.scala
+++ b/modules/compliance-tests/test/src/EqVisitorSpec.scala
@@ -278,12 +278,15 @@ object EqVisitorSpec extends FunSuite {
case class IntValue(value: Int) extends IntOrString
case class StringValue(value: String) extends IntOrString
implicit val schema: Schema[IntOrString] = {
- val intValue = int.oneOf[IntOrString]("intValue", IntValue(_))
- val stringValue = string.oneOf[IntOrString]("stringValue", StringValue(_))
- union(intValue, stringValue) {
- case IntValue(int) => intValue(int)
- case StringValue(string) => stringValue(string)
- }.withId(ShapeId("", "Foo"))
+ val intValue = int.oneOf[IntOrString]("intValue", IntValue(_)) {
+ case IntValue(int) => int
+ }
+ val stringValue =
+ string.oneOf[IntOrString]("stringValue", StringValue(_)) {
+ case StringValue(string) => string
+ }
+ union(intValue, stringValue).reflective
+ .withId(ShapeId("", "Foo"))
}
val foo0: IntOrString = IntValue(1)
val foo1: IntOrString = IntValue(1)
diff --git a/modules/core/src/generated/kinds/polyFunctions.scala b/modules/core/src/generated/kinds/polyFunctions.scala
index a9e09ae1e..cb390c789 100644
--- a/modules/core/src/generated/kinds/polyFunctions.scala
+++ b/modules/core/src/generated/kinds/polyFunctions.scala
@@ -27,21 +27,6 @@ trait PolyFunction[F[_], G[_]]{ self =>
final def andThen[H[_]](other: PolyFunction[G, H]): PolyFunction[F, H] = new PolyFunction[F, H]{
def apply[A0](fa: F[A0]): H[A0] = other(self(fa))
}
-
- import Kind1._
- private[smithy4s] final def unsafeCacheBy[K](allPossibleInputs: Seq[Existential[F]], getKey: Existential[F] => K): PolyFunction[F, G] =
- new PolyFunction[F, G] {
- private val map: Map[K, Any] = {
- val builder = Map.newBuilder[K, Any]
- allPossibleInputs.foreach(input =>
- builder += getKey(input) -> self
- .apply(input.asInstanceOf[F[Any]])
- .asInstanceOf[Any]
- )
- builder.result()
- }
- def apply[A0](input: F[A0]): G[A0] = map(getKey(existential(input))).asInstanceOf[G[A0]]
- }
}
object PolyFunction{
type From[F[_]] = {
@@ -64,21 +49,6 @@ trait PolyFunction2[F[_, _], G[_, _]]{ self =>
final def andThen[H[_, _]](other: PolyFunction2[G, H]): PolyFunction2[F, H] = new PolyFunction2[F, H]{
def apply[A0, A1](fa: F[A0, A1]): H[A0, A1] = other(self(fa))
}
-
- import Kind2._
- private[smithy4s] final def unsafeCacheBy[K](allPossibleInputs: Seq[Existential[F]], getKey: Existential[F] => K): PolyFunction2[F, G] =
- new PolyFunction2[F, G] {
- private val map: Map[K, Any] = {
- val builder = Map.newBuilder[K, Any]
- allPossibleInputs.foreach(input =>
- builder += getKey(input) -> self
- .apply(input.asInstanceOf[F[Any, Any]])
- .asInstanceOf[Any]
- )
- builder.result()
- }
- def apply[A0, A1](input: F[A0, A1]): G[A0, A1] = map(getKey(existential(input))).asInstanceOf[G[A0, A1]]
- }
}
object PolyFunction2{
type From[F[_, _]] = {
@@ -102,21 +72,6 @@ trait PolyFunction5[F[_, _, _, _, _], G[_, _, _, _, _]]{ self =>
final def andThen[H[_, _, _, _, _]](other: PolyFunction5[G, H]): PolyFunction5[F, H] = new PolyFunction5[F, H]{
def apply[A0, A1, A2, A3, A4](fa: F[A0, A1, A2, A3, A4]): H[A0, A1, A2, A3, A4] = other(self(fa))
}
-
- import Kind5._
- private[smithy4s] final def unsafeCacheBy[K](allPossibleInputs: Seq[Existential[F]], getKey: Existential[F] => K): PolyFunction5[F, G] =
- new PolyFunction5[F, G] {
- private val map: Map[K, Any] = {
- val builder = Map.newBuilder[K, Any]
- allPossibleInputs.foreach(input =>
- builder += getKey(input) -> self
- .apply(input.asInstanceOf[F[Any, Any, Any, Any, Any]])
- .asInstanceOf[Any]
- )
- builder.result()
- }
- def apply[A0, A1, A2, A3, A4](input: F[A0, A1, A2, A3, A4]): G[A0, A1, A2, A3, A4] = map(getKey(existential(input))).asInstanceOf[G[A0, A1, A2, A3, A4]]
- }
}
object PolyFunction5{
type From[F[_, _, _, _, _]] = {
diff --git a/modules/core/src/generated/schema/PartiallyAppliedTuple.scala b/modules/core/src/generated/schema/PartiallyAppliedTuple.scala
new file mode 100644
index 000000000..b62ce5fc2
--- /dev/null
+++ b/modules/core/src/generated/schema/PartiallyAppliedTuple.scala
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021-2022 Disney Streaming
+ *
+ * Licensed under the Tomorrow Open Source Technology License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://disneystreaming.github.io/TOST-1.0.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/////// THIS FILE WAS GENERATED AT BUILD TIME, AND CHECKED-IN FOR DISCOVERABILITY ///////
+
+package smithy4s
+package schema
+
+class PartiallyAppliedTuple protected[schema](placeholder: ShapeId) {
+
+ def apply[A0, A1](a0: Schema[A0], a1: Schema[A1]): Schema.StructSchema[(A0, A1)] = Schema.StructSchema[(A0, A1)](placeholder, Hints.empty, Vector(a0.required[(A0, A1)]("_1", _._1), a1.required[(A0, A1)]("_2", _._2)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1]))
+ def apply[A0, A1, A2](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2]): Schema.StructSchema[(A0, A1, A2)] = Schema.StructSchema[(A0, A1, A2)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2)]("_1", _._1), a1.required[(A0, A1, A2)]("_2", _._2), a2.required[(A0, A1, A2)]("_3", _._3)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2]))
+ def apply[A0, A1, A2, A3](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3]): Schema.StructSchema[(A0, A1, A2, A3)] = Schema.StructSchema[(A0, A1, A2, A3)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3)]("_1", _._1), a1.required[(A0, A1, A2, A3)]("_2", _._2), a2.required[(A0, A1, A2, A3)]("_3", _._3), a3.required[(A0, A1, A2, A3)]("_4", _._4)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3]))
+ def apply[A0, A1, A2, A3, A4](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4]): Schema.StructSchema[(A0, A1, A2, A3, A4)] = Schema.StructSchema[(A0, A1, A2, A3, A4)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4)]("_5", _._5)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4]))
+ def apply[A0, A1, A2, A3, A4, A5](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5)]("_6", _._6)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5]))
+ def apply[A0, A1, A2, A3, A4, A5, A6](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6)]("_7", _._7)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7)]("_8", _._8)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8)]("_9", _._9)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)]("_10", _._10)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)]("_11", _._11)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)]("_12", _._12)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)]("_13", _._13)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)]("_14", _._14)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)]("_15", _._15)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)]("_16", _._16)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)]("_17", _._17)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16], a17: Schema[A17]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_17", _._17), a17.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17)]("_18", _._18)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16], arr(17).asInstanceOf[A17]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16], a17: Schema[A17], a18: Schema[A18]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_17", _._17), a17.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_18", _._18), a18.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18)]("_19", _._19)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16], arr(17).asInstanceOf[A17], arr(18).asInstanceOf[A18]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16], a17: Schema[A17], a18: Schema[A18], a19: Schema[A19]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_17", _._17), a17.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_18", _._18), a18.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_19", _._19), a19.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19)]("_20", _._20)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16], arr(17).asInstanceOf[A17], arr(18).asInstanceOf[A18], arr(19).asInstanceOf[A19]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16], a17: Schema[A17], a18: Schema[A18], a19: Schema[A19], a20: Schema[A20]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_17", _._17), a17.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_18", _._18), a18.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_19", _._19), a19.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_20", _._20), a20.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]("_21", _._21)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16], arr(17).asInstanceOf[A17], arr(18).asInstanceOf[A18], arr(19).asInstanceOf[A19], arr(20).asInstanceOf[A20]))
+ def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21](a0: Schema[A0], a1: Schema[A1], a2: Schema[A2], a3: Schema[A3], a4: Schema[A4], a5: Schema[A5], a6: Schema[A6], a7: Schema[A7], a8: Schema[A8], a9: Schema[A9], a10: Schema[A10], a11: Schema[A11], a12: Schema[A12], a13: Schema[A13], a14: Schema[A14], a15: Schema[A15], a16: Schema[A16], a17: Schema[A17], a18: Schema[A18], a19: Schema[A19], a20: Schema[A20], a21: Schema[A21]): Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)] = Schema.StructSchema[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)](placeholder, Hints.empty, Vector(a0.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_1", _._1), a1.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_2", _._2), a2.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_3", _._3), a3.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_4", _._4), a4.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_5", _._5), a5.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_6", _._6), a6.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_7", _._7), a7.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_8", _._8), a8.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_9", _._9), a9.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_10", _._10), a10.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_11", _._11), a11.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_12", _._12), a12.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_13", _._13), a13.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_14", _._14), a14.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_15", _._15), a15.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_16", _._16), a16.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_17", _._17), a17.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_18", _._18), a18.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_19", _._19), a19.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_20", _._20), a20.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_21", _._21), a21.required[(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21)]("_22", _._22)), arr => (arr(0).asInstanceOf[A0], arr(1).asInstanceOf[A1], arr(2).asInstanceOf[A2], arr(3).asInstanceOf[A3], arr(4).asInstanceOf[A4], arr(5).asInstanceOf[A5], arr(6).asInstanceOf[A6], arr(7).asInstanceOf[A7], arr(8).asInstanceOf[A8], arr(9).asInstanceOf[A9], arr(10).asInstanceOf[A10], arr(11).asInstanceOf[A11], arr(12).asInstanceOf[A12], arr(13).asInstanceOf[A13], arr(14).asInstanceOf[A14], arr(15).asInstanceOf[A15], arr(16).asInstanceOf[A16], arr(17).asInstanceOf[A17], arr(18).asInstanceOf[A18], arr(19).asInstanceOf[A19], arr(20).asInstanceOf[A20], arr(21).asInstanceOf[A21]))
+
+}
\ No newline at end of file
diff --git a/modules/core/src/smithy4s/Service.scala b/modules/core/src/smithy4s/Service.scala
index c41274200..8ff6c82e8 100644
--- a/modules/core/src/smithy4s/Service.scala
+++ b/modules/core/src/smithy4s/Service.scala
@@ -109,8 +109,11 @@ trait Service[Alg[_[_, _, _, _, _]]] extends FunctorK5[Alg] with HasId {
type ErrorAware[F[_, _]] = BiFunctorAlgebra[Alg, F]
val service: Service[Alg] = this
- def endpoints: List[Endpoint[_, _, _, _, _]]
- def endpoint[I, E, O, SI, SO](op: Operation[I, E, O, SI, SO]): (I, Endpoint[I, E, O, SI, SO])
+ def endpoints: IndexedSeq[Endpoint[_, _, _, _, _]]
+ def ordinal[I, E, O, SI, SO](op: Operation[I, E, O, SI, SO]) : Int
+ def input[I, E, O, SI, SO](op: Operation[I, E, O, SI, SO]): I
+ def endpoint[I, E, O, SI, SO](op: Operation[I, E, O, SI, SO]): Endpoint[I, E, O, SI, SO] =
+ endpoints(ordinal(op)).asInstanceOf[Endpoint[I, E, O, SI, SO]]
def version: String
def hints: Hints
def reified: Alg[Operation]
@@ -118,7 +121,8 @@ trait Service[Alg[_[_, _, _, _, _]]] extends FunctorK5[Alg] with HasId {
def toPolyFunction[P[_, _, _, _, _]](algebra: Alg[P]): PolyFunction5[Operation, P]
final val opToEndpoint: PolyFunction5[Operation, Endpoint] = new PolyFunction5[Operation, Endpoint]{
- def apply[I, E, O, SI, SO](op: Operation[I,E,O,SI,SO]): Endpoint[I,E,O,SI,SO] = endpoint(op)._2
+ def apply[I, E, O, SI, SO](op: Operation[I,E,O,SI,SO]): Endpoint[I,E,O,SI,SO] =
+ endpoint(op)
}
/**
@@ -127,10 +131,15 @@ trait Service[Alg[_[_, _, _, _, _]]] extends FunctorK5[Alg] with HasId {
* to the service and routes it to the correct function, returning the result.
*/
final def interpreter[F[_, _, _, _, _]](compiler: EndpointCompiler[F]) : Interpreter[F] = new Interpreter[F]{
- val cached = compiler.unsafeCacheBy(endpoints.map(Kind5.existential(_)), identity)
+ private val cache: Array[Any] = {
+ val builder = scala.collection.mutable.ArrayBuffer[Any]()
+ endpoints.foreach(ep =>
+ builder += compiler(ep).asInstanceOf[Any]
+ )
+ builder.toArray
+ }
def apply[I, E, O, SI, SO](operation: Operation[I, E, O, SI, SO]): F[I, E, O, SI, SO] = {
- val (input, ep) = endpoint(operation)
- cached(ep).apply(input)
+ cache(ordinal(operation)).asInstanceOf[I => F[I, E, O, SI, SO]].apply(input(operation))
}
}
diff --git a/modules/core/src/smithy4s/Transformation.scala b/modules/core/src/smithy4s/Transformation.scala
index 56cb84184..95879467c 100644
--- a/modules/core/src/smithy4s/Transformation.scala
+++ b/modules/core/src/smithy4s/Transformation.scala
@@ -86,7 +86,7 @@ object Transformation {
val polyFunction = service.toPolyFunction[Kind1[F]#toKind5](algF)
val interpreter = new PolyFunction5[service.Operation, Kind2[G]#toKind5]{
def apply[I, E, O, SI, SO](op: service.Operation[I, E, O, SI, SO]): G[E,O] = {
- val endpoint = service.opToEndpoint(op)
+ val endpoint = service.endpoint(op)
val catcher: Throwable => Option[E] = endpoint.errorable match {
case None => PartialFunction.empty[Throwable, Option[E]]
case Some(value) => value.liftError(_)
@@ -105,7 +105,7 @@ object Transformation {
val polyFunction = service.toPolyFunction[Kind2[F]#toKind5](algF)
val interpreter = new PolyFunction5[service.Operation, Kind1[G]#toKind5]{
def apply[I, E, O, SI, SO](op: service.Operation[I, E, O, SI, SO]): G[O] = {
- val endpoint = service.opToEndpoint(op)
+ val endpoint = service.endpoint(op)
val thrower: E => Throwable = endpoint.errorable match {
case None =>
// This case should not happen, as an endpoint without an errorable means the operation's error type is `Nothing`
diff --git a/modules/core/src/smithy4s/http/HttpBinding.scala b/modules/core/src/smithy4s/http/HttpBinding.scala
index 238ea1c1f..999341d8b 100644
--- a/modules/core/src/smithy4s/http/HttpBinding.scala
+++ b/modules/core/src/smithy4s/http/HttpBinding.scala
@@ -102,13 +102,13 @@ object HttpBinding extends ShapeTag.Companion[HttpBinding] {
val status =
StatusCodeBinding.schema.oneOf[HttpBinding]("statusCode")
- union(header, query, path) {
- case h: HeaderBinding => header(h)
- case q: QueryBinding => query(q)
- case p: PathBinding => path(p)
- case QueryParamsBinding => queryParams(QueryParamsBinding)
- case h: HeaderPrefixBinding => headerPrefix(h)
- case StatusCodeBinding => status(StatusCodeBinding)
+ union(header, query, path, queryParams, headerPrefix, status) {
+ case _: HeaderBinding => 0
+ case _: QueryBinding => 1
+ case _: PathBinding => 2
+ case QueryParamsBinding => 3
+ case _: HeaderPrefixBinding => 4
+ case StatusCodeBinding => 5
}
}
diff --git a/modules/core/src/smithy4s/http/HttpContractError.scala b/modules/core/src/smithy4s/http/HttpContractError.scala
index 6bf0d81da..e58b8889d 100644
--- a/modules/core/src/smithy4s/http/HttpContractError.scala
+++ b/modules/core/src/smithy4s/http/HttpContractError.scala
@@ -39,8 +39,8 @@ object HttpContractError {
val payload = HttpPayloadError.schema.oneOf[HttpContractError]("payload")
val metadata = MetadataError.schema.oneOf[HttpContractError]("metadata")
union(payload, metadata) {
- case n: HttpPayloadError => payload(n)
- case w: MetadataError => metadata(w)
+ case _: HttpPayloadError => 0
+ case _: MetadataError => 1
}
}
@@ -154,12 +154,19 @@ object MetadataError {
FailedConstraint.schema.oneOf[MetadataError]("failedConstraint")
val impossibleDecoding =
ImpossibleDecoding.schema.oneOf[MetadataError]("impossibleDecoding")
- union(notFound, wrongType, arityError, failedConstraint) {
- case n: NotFound => notFound(n)
- case w: WrongType => wrongType(w)
- case a: ArityError => arityError(a)
- case f: FailedConstraint => failedConstraint(f)
- case i: ImpossibleDecoding => impossibleDecoding(i)
+
+ union(
+ notFound,
+ wrongType,
+ arityError,
+ failedConstraint,
+ impossibleDecoding
+ ) {
+ case _: NotFound => 0
+ case _: WrongType => 1
+ case _: ArityError => 2
+ case _: FailedConstraint => 3
+ case _: ImpossibleDecoding => 4
}
}
diff --git a/modules/core/src/smithy4s/http/HttpErrorSelector.scala b/modules/core/src/smithy4s/http/HttpErrorSelector.scala
index 7baa89b34..295e9449c 100644
--- a/modules/core/src/smithy4s/http/HttpErrorSelector.scala
+++ b/modules/core/src/smithy4s/http/HttpErrorSelector.scala
@@ -23,7 +23,6 @@ import smithy.api.HttpError
import smithy4s.schema.CachedSchemaCompiler
import smithy4s.capability.Covariant
import smithy4s.kinds.PolyFunction
-import smithy4s.kinds.Kind1
/**
* Utility function to help find the decoder matching a certain discriminator
@@ -80,9 +79,8 @@ private[http] final class HttpErrorSelector[F[_]: Covariant, E](
type ConstF[A] = F[E]
val cachedDecoders: PolyFunction[Alt[E, *], ConstF] =
new PolyFunction[Alt[E, *], ConstF] {
- def apply[A](alt: Alt[E, A]): F[E] = {
+ def compileAlt[A](alt: Alt[E, A]): F[E] = {
val schema = alt.schema
- // TODO: apply proper memoization of error instances/
// In the line below, we create a new, ephemeral cache for the dynamic recompilation of the error schema.
// This is because the "compile entity encoder" method can trigger a transformation of hints, which
// lead to cache-miss and would lead to new entries in existing cache, effectively leading to a memory leak.
@@ -90,10 +88,15 @@ private[http] final class HttpErrorSelector[F[_]: Covariant, E](
val errorCodec: F[A] = compiler.fromSchema(schema, cache)
Covariant[F].map[A, E](errorCodec)(alt.inject)
}
- }.unsafeCacheBy(
- alts.map(Kind1.existential(_)),
- identity(_)
- )
+ val builder = Map.newBuilder[Any, Any]
+ alts.foreach { alt =>
+ builder += alt -> compileAlt(alt)
+ }
+ val resultCache = builder.result()
+ def apply[A](alt: Alt[E, A]): F[E] = {
+ resultCache(alt).asInstanceOf[F[E]]
+ }
+ }
def apply(
discriminator: HttpDiscriminator
diff --git a/modules/core/src/smithy4s/internals/DocumentDecoderSchemaVisitor.scala b/modules/core/src/smithy4s/internals/DocumentDecoderSchemaVisitor.scala
index 9a8530753..a977fa7b1 100644
--- a/modules/core/src/smithy4s/internals/DocumentDecoderSchemaVisitor.scala
+++ b/modules/core/src/smithy4s/internals/DocumentDecoderSchemaVisitor.scala
@@ -448,7 +448,7 @@ class DocumentDecoderSchemaVisitor(
alt.schema.hints.get(JsonName).map(_.value).getOrElse(alt.label)
val decoders: DecoderMap[U] =
- alternatives.map { case alt @ Alt(_, instance, inject) =>
+ alternatives.map { case alt @ Alt(_, instance, inject, _) =>
val label = jsonLabel(alt)
val encoder = { (pp: List[PayloadPath.Segment], doc: Document) =>
inject(apply(instance)(label :: pp, doc))
diff --git a/modules/core/src/smithy4s/internals/InputOutput.scala b/modules/core/src/smithy4s/internals/InputOutput.scala
index 3071ee724..8f834317e 100644
--- a/modules/core/src/smithy4s/internals/InputOutput.scala
+++ b/modules/core/src/smithy4s/internals/InputOutput.scala
@@ -38,8 +38,8 @@ object InputOutput extends ShapeTag.Companion[InputOutput] {
.oneOf[InputOutput]("output")
Schema
.union(inputAlt, outputAlt) {
- case Input => inputAlt(Input)
- case Output => outputAlt(Output)
+ case Input => 0
+ case Output => 1
}
.withId(id)
}
diff --git a/modules/core/src/smithy4s/schema/Alt.scala b/modules/core/src/smithy4s/schema/Alt.scala
index d32c8e6da..e9d620d37 100644
--- a/modules/core/src/smithy4s/schema/Alt.scala
+++ b/modules/core/src/smithy4s/schema/Alt.scala
@@ -26,15 +26,13 @@ import kinds._
final case class Alt[U, A](
label: String,
schema: Schema[A],
- inject: A => U
+ inject: A => U,
+ project: PartialFunction[U, A]
) {
@deprecated("use .schema instead", since = "0.18.0")
def instance: Schema[A] = schema
- def apply(value: A): Alt.WithValue[U, A] =
- Alt.WithValue(this, value)
-
def hints: Hints = schema.hints
def memberHints: Hints = schema.hints.memberHints
@@ -58,11 +56,6 @@ final case class Alt[U, A](
}
object Alt {
- final case class WithValue[U, A](
- private[Alt] val alt: Alt[U, A],
- value: A
- )
-
/**
* Precompiles an Alt to produce an instance of `G`
*/
@@ -86,7 +79,8 @@ object Alt {
encoderK: EncoderK[G, Result]
): G[U]
- def projector[A](alt: Alt[U, A]): U => Option[A]
+ def ordinal(u: U): Int
+
}
object Dispatcher {
@@ -94,43 +88,39 @@ object Alt {
def fromUnion[U](union: Schema.UnionSchema[U]): Dispatcher[U] =
apply(
alts = union.alternatives,
- dispatchF = union.dispatch
+ ordinal = union.ordinal
)
private[smithy4s] def apply[U](
alts: Vector[Alt[U, _]],
- dispatchF: U => Alt.WithValue[U, _]
- ): Dispatcher[U] = new Impl[U](alts, dispatchF)
+ ordinal: U => Int
+ ): Dispatcher[U] = new Impl[U](alts, ordinal)
private[smithy4s] case class Impl[U](
alts: Vector[Alt[U, _]],
- underlying: U => Alt.WithValue[U, _]
+ ord: U => Int
) extends Dispatcher[U] {
- def compile[G[_], Result](precompile: Precompiler[G])(implicit
- encoderK: EncoderK[G, Result]
- ): G[U] = {
- val precompiledAlts =
- precompile.toPolyFunction
- .unsafeCacheBy[String](
- alts.map(Kind1.existential(_)),
- (alt: Kind1.Existential[Alt[U, *]]) =>
- alt.asInstanceOf[Alt[U, _]].label
- )
+ def compile[F[_], Result](precompile: Precompiler[F])(implicit
+ encoderK: EncoderK[F, Result]
+ ): F[U] = {
+ val compiler = precompile.toPolyFunction[U]
+ val builder = scala.collection.mutable.ArrayBuffer[Any]()
+ alts.foreach { alt =>
+ builder += compiler(alt)
+ }
+ val precompiledAlts = builder.toArray
encoderK.absorb[U] { u =>
- underlying(u) match {
- case awv: Alt.WithValue[U, a] =>
- encoderK(precompiledAlts(awv.alt), awv.value)
- }
+ val ord = ordinal(u)
+ encoderK(
+ precompiledAlts(ord).asInstanceOf[F[Any]],
+ alts(ord).project(u)
+ )
}
}
- def projector[A](alt: Alt[U, A]): U => Option[A] = { u =>
- val under = underlying(u)
- if (under.alt.label == alt.label)
- Some(under.value.asInstanceOf[A])
- else None
- }
+ def ordinal(u: U): Int = ord(u)
+
}
}
diff --git a/modules/core/src/smithy4s/schema/PartiallyAppliedUnion.scala b/modules/core/src/smithy4s/schema/PartiallyAppliedUnion.scala
new file mode 100644
index 000000000..61aef91d9
--- /dev/null
+++ b/modules/core/src/smithy4s/schema/PartiallyAppliedUnion.scala
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2021-2022 Disney Streaming
+ *
+ * Licensed under the Tomorrow Open Source Technology License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://disneystreaming.github.io/TOST-1.0.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package smithy4s.schema
+
+import smithy4s.Hints
+
+final class PartiallyAppliedUnion[U](val alts: Vector[Alt[U, _]])
+ extends AnyVal {
+
+ def apply(f: U => Int): Schema.UnionSchema[U] =
+ Schema.UnionSchema(Schema.placeholder, Hints.empty, alts, f)
+
+ /**
+ * A convenience method to build union schemas easily. It shouldn't be
+ * used in real usecases.
+ */
+ def reflective: Schema.UnionSchema[U] = {
+ def ordinal(u: U) = {
+ var i = -1
+ var found = false
+ while ((i < alts.size) && !found) {
+ i += 1
+ found = alts(i).project.isDefinedAt(u)
+ }
+ if (found) i
+ else throw new scala.MatchError(u)
+ }
+ Schema.UnionSchema(
+ Schema.placeholder,
+ Hints.empty,
+ alts,
+ ordinal
+ )
+ }
+
+}
diff --git a/modules/core/src/smithy4s/schema/Schema.scala b/modules/core/src/smithy4s/schema/Schema.scala
index 7f4b14b33..ef7783e8a 100644
--- a/modules/core/src/smithy4s/schema/Schema.scala
+++ b/modules/core/src/smithy4s/schema/Schema.scala
@@ -18,6 +18,7 @@ package smithy4s
package schema
import Schema._
+import scala.reflect.ClassTag
// format: off
sealed trait Schema[A]{
@@ -153,7 +154,7 @@ object Schema {
final case class MapSchema[K, V](shapeId: ShapeId, hints: Hints, key: Schema[K], value: Schema[V]) extends Schema[Map[K, V]]
final case class EnumerationSchema[E](shapeId: ShapeId, hints: Hints, tag: EnumTag, values: List[EnumValue[E]], total: E => EnumValue[E]) extends Schema[E]
final case class StructSchema[S](shapeId: ShapeId, hints: Hints, fields: Vector[Field[S, _]], make: IndexedSeq[Any] => S) extends Schema[S]
- final case class UnionSchema[U](shapeId: ShapeId, hints: Hints, alternatives: Vector[Alt[U, _]], dispatch: U => Alt.WithValue[U, _]) extends Schema[U]
+ final case class UnionSchema[U](shapeId: ShapeId, hints: Hints, alternatives: Vector[Alt[U, _]], ordinal: U => Int) extends Schema[U]
final case class OptionSchema[A](underlying: Schema[A]) extends Schema[Option[A]]{
def hints: Hints = underlying.hints
def shapeId: ShapeId = underlying.shapeId
@@ -202,7 +203,7 @@ object Schema {
val unit: Schema[Unit] = Schema.StructSchema(ShapeId("smithy.api", "Unit"), Hints.empty, Vector.empty, _ => ())
- private val placeholder: ShapeId = ShapeId("placeholder", "Placeholder")
+ private[schema] val placeholder: ShapeId = ShapeId("placeholder", "Placeholder")
def list[A](a: Schema[A]): Schema[List[A]] = Schema.CollectionSchema[List, A](placeholder, Hints.empty, CollectionTag.ListTag, a)
def set[A](a: Schema[A]): Schema[Set[A]] = Schema.CollectionSchema[Set, A](placeholder, Hints.empty, CollectionTag.SetTag, a)
@@ -221,11 +222,17 @@ object Schema {
def recursive[A](s: => Schema[A]): Schema[A] = Schema.LazySchema(Lazy(s))
- def union[U](alts: Alt[U, _]*)(dispatch: U => Alt.WithValue[U, _]): Schema.UnionSchema[U] =
- Schema.UnionSchema(placeholder, Hints.empty, alts.toVector, dispatch)
+ def union[U](alts: Vector[Alt[U, _]]): PartiallyAppliedUnion[U] = new PartiallyAppliedUnion(alts)
+ def union[U](alts: Alt[U, _]*) : PartiallyAppliedUnion[U] = new PartiallyAppliedUnion(alts.toVector)
- def union[U](alts: Vector[Alt[U, _]])(dispatch: U => Alt.WithValue[U, _]): Schema.UnionSchema[U] =
- Schema.UnionSchema(placeholder, Hints.empty, alts, dispatch)
+ def either[A, B](left: Schema[A], right: Schema[B]) : Schema[Either[A, B]] = {
+ val l = left.oneOf[Either[A, B]]("left", Left(_: A)) { case Left(a) => a }
+ val r = right.oneOf[Either[A, B]]("right", Right(_: B)) { case Right(b) => b }
+ union(l, r) {
+ case Left(_) => 0
+ case Right(_) => 1
+ }
+ }
def enumeration[E](total: E => EnumValue[E], tag: EnumTag, values: List[EnumValue[E]]): Schema[E] =
Schema.EnumerationSchema(placeholder, Hints.empty, tag, values, total)
@@ -254,7 +261,7 @@ object Schema {
def constant[A](a: A): Schema[A] = Schema.StructSchema(placeholder, Hints.empty, Vector.empty, _ => a)
def struct[S]: PartiallyAppliedStruct[S] = new PartiallyAppliedStruct[S](placeholder)
-
+ val tuple: PartiallyAppliedTuple = new PartiallyAppliedTuple(placeholder)
private [smithy4s] class PartiallyAppliedRequired[S, A](private val schema: Schema[A]) extends AnyVal {
def apply(label: String, get: S => A): Field[S, A] = Field.required(label, schema, get)
}
@@ -264,8 +271,9 @@ object Schema {
}
private [smithy4s] class PartiallyAppliedOneOf[U, A](private val schema: Schema[A]) extends AnyVal {
- def apply(label: String)(implicit ev: A <:< U): Alt[U, A] = Alt(label, schema, ev)
- def apply(label: String, inject: A => U): Alt[U, A] = Alt(label, schema, inject)
+ def apply(label: String)(implicit ev: A <:< U, ct: ClassTag[A]): Alt[U, A] = Alt(label, schema, ev, { case a: A => a })
+ def apply(label: String, inject: A => U)(project: PartialFunction[U, A]): Alt[U, A] =
+ Alt(label, schema, inject, project)
}
private [smithy4s] class PartiallyAppliedRefinement[A, B](private val schema: Schema[A]) extends AnyVal {
diff --git a/modules/decline/src/Smithy4sCli.scala b/modules/decline/src/Smithy4sCli.scala
index af22d75f5..5f17ac8be 100644
--- a/modules/decline/src/Smithy4sCli.scala
+++ b/modules/decline/src/Smithy4sCli.scala
@@ -115,8 +115,8 @@ class Smithy4sCli[Alg[_[_, _, _, _, _]], F[_]: MonadThrow](
}
}
- def opts: Opts[F[Unit]] = service.endpoints
- .foldMapK(endpointSubcommand(_))
+ def opts: Opts[F[Unit]] =
+ service.endpoints.toVector.foldMapK(endpointSubcommand(_))
def command: Command[F[Unit]] = {
Command(
diff --git a/modules/decline/test/src/smithy4s/decline/core/OptsVisitorSpec.scala b/modules/decline/test/src/smithy4s/decline/core/OptsVisitorSpec.scala
index ea0a068d1..f5ab687d3 100644
--- a/modules/decline/test/src/smithy4s/decline/core/OptsVisitorSpec.scala
+++ b/modules/decline/test/src/smithy4s/decline/core/OptsVisitorSpec.scala
@@ -42,17 +42,7 @@ object OptsSchematicSpec extends SimpleIOSuite {
val sampleUnion = sampleStruct(
"example", {
- val lhs = sampleStruct("int", int)
- .oneOf[Either[Int, String]]("unused2", (_: Int).asLeft)
-
- val rhs = sampleStruct("str", string)
- .oneOf[Either[Int, String]]("unused", (_: String).asRight)
-
- union(
- lhs,
- rhs
- )(_.fold(lhs(_), rhs.apply(_)))
-
+ Schema.either(sampleStruct("int", int), sampleStruct("str", string))
}
)
diff --git a/modules/docs/markdown/05-design/02-schemas.md b/modules/docs/markdown/05-design/02-schemas.md
index 38dda3eb2..dbbe7917e 100644
--- a/modules/docs/markdown/05-design/02-schemas.md
+++ b/modules/docs/markdown/05-design/02-schemas.md
@@ -132,7 +132,7 @@ Since 0.18, the concept of Option in Smithy4s is backed
by a `OptionSchema` member of the `Schema` GADT. Having Option as a first-class citizen has some advantages, as it allows to support [sparse collections](https://smithy.io/2.0/spec/aggregate-types.html?highlight=sparse%20collections#list-member-optionality).
The downside is that this allows to create schemas (and therefore codecs) that do not abide by round-tripping properties. Indeed, once data is on the wire, it's often
-impossible to distinguish `Option[Option[Option[Int]] ]` from `Option[Int]`.
+impossible to distinguish `Option[Option[Option[Int]] ]` from `Option[Int]`.
### Unions
@@ -184,8 +184,8 @@ object Bar extends smithy4s.ShapeTag.Companion[Bar] {
ACase.alt,
BCase.alt,
){
- case c: ACase => ACase.alt(c)
- case c: BCase => BCase.alt(c)
+ case _: ACase => 0
+ case _: BCase => 1
}.withId(id)
}
```
@@ -202,7 +202,7 @@ Much like a `field`, an `alt` contains a label, and can carry hints. But unlike
This is useful for de-serialisation, when, after successfully de-serialising a member of a union, you need to inject it into the ADT to return the expected type.
As for the union's schema, it is somewhat similar to the structure's, in that it references all its alternatives.
-But instead of a structure's constructor, we have a dispatch function instead, which contains a pattern match against all the possible members, and dispatches the "down-casted" value to its corresponding alternative.
+But instead of a structure's constructor, we have a dispatch function instead, which contains a pattern match against all the possible members, and dispatches the "down-casted" value to its corresponding ordinal, allowing to recover the corresponding alternative.
This is useful for serialisation, when the behaviour of the alternatives can only be applied to values of the corresponding type: "if my ADT is an A, then I serialise the A, and add a discriminating tag to the serialised A".
### Named simple shapes
diff --git a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicLambdas.scala b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicLambdas.scala
index 1159b1d16..d7cc94f21 100644
--- a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicLambdas.scala
+++ b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicLambdas.scala
@@ -16,8 +16,6 @@
package smithy4s.dynamic.internals
-import smithy4s.schema.Alt
-
/**
* A bunch of hash-code stable lambdas that are less likely to break memoization
* that may be able to SchemaVisitors.
@@ -27,6 +25,16 @@ private[internals] object DynamicLambdas {
def apply(data: DynData): DynAlt = (index, data)
}
+ final case class Projector(index: Int)
+ extends PartialFunction[DynAlt, DynData] {
+ def isDefinedAt(dynAlt: DynAlt): Boolean = dynAlt._1 == index
+ def apply(dynAlt: DynAlt): DynData = dynAlt._2
+ }
+
+ case object Ordinal extends (DynAlt => Int) {
+ def apply(alt: DynAlt): Int = alt._1
+ }
+
final case class Accessor(index: Int) extends (DynStruct => DynData) {
def apply(data: DynStruct): DynData = data(index)
}
@@ -49,13 +57,4 @@ private[internals] object DynamicLambdas {
}
}
- case class Dispatcher(alts: IndexedSeq[Alt[DynAlt, DynData]])
- extends (DynAlt => Alt.WithValue[DynAlt, DynData]) {
- def apply(dynAlt: DynAlt): Alt.WithValue[DynAlt, DynData] = {
- val index = dynAlt._1
- val data = dynAlt._2
- alts(index).apply(data)
- }
- }
-
}
diff --git a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicModelCompiler.scala b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicModelCompiler.scala
index 0a7e8787f..99416e4a0 100644
--- a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicModelCompiler.scala
+++ b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicModelCompiler.scala
@@ -383,7 +383,8 @@ private[dynamic] object Compiler {
Alt[DynAlt, DynData](
shapeId.name,
schema,
- (index, _: DynData)
+ (index, _: DynData),
+ { case (`index`, dynData) => dynData }
)
}
@@ -403,9 +404,7 @@ private[dynamic] object Compiler {
errorId,
Hints.empty,
alts.toVector,
- { case (index, data) =>
- alts(index).apply(data)
- }
+ { case (index, _) => index }
)
)
}
@@ -474,7 +473,7 @@ private[dynamic] object Compiler {
DynamicService(
id,
shape.version.getOrElse(""),
- endpoints,
+ endpoints.toVector,
allHints(shape.traits)
)
}
@@ -523,17 +522,19 @@ private[dynamic] object Compiler {
case ((label, mShape), index) =>
val memberHints = allHints(mShape.traits)
schema(mShape.target)
- .map(_.oneOf[DynAlt](label, Injector(index)))
+ .map(
+ _.oneOf[DynAlt](label, Injector(index))(Projector(index))
+ )
.map(_.addHints(memberHints))
}
if (isRecursive(id)) {
Eval.later(recursive {
val alts = lAlts.value
- union(alts)(Dispatcher(alts))
+ union(alts)(Ordinal)
})
} else
lAlts.map { alts =>
- union(alts)(Dispatcher(alts))
+ union(alts)(Ordinal)
}
}
)
diff --git a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicService.scala b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicService.scala
index 86a30c629..a8140e0bc 100644
--- a/modules/dynamic/src/smithy4s/dynamic/internals/DynamicService.scala
+++ b/modules/dynamic/src/smithy4s/dynamic/internals/DynamicService.scala
@@ -23,7 +23,7 @@ import smithy4s.kinds.PolyFunction5
private[internals] case class DynamicService(
id: ShapeId,
version: String,
- endpoints: List[DynamicEndpoint],
+ endpoints: Vector[DynamicEndpoint],
hints: Hints
) extends Service.Reflective[DynamicOp]
with DynamicSchemaIndex.ServiceWrapper {
@@ -31,17 +31,11 @@ private[internals] case class DynamicService(
type Alg[P[_, _, _, _, _]] = PolyFunction5.From[DynamicOp]#Algebra[P]
override val service: Service[Alg] = this
- private lazy val endpointMap: Map[ShapeId, Endpoint[_, _, _, _, _]] =
- endpoints.map(ep => ep.id -> ep).toMap
+ private lazy val ordinalMap: Map[ShapeId, Int] =
+ endpoints.map(_.id).zipWithIndex.toMap
- def endpoint[I, E, O, SI, SO](
- op: DynamicOp[I, E, O, SI, SO]
- ): (I, Endpoint[I, E, O, SI, SO]) = {
- val endpoint = endpointMap
- .getOrElse(op.id, sys.error("Unknown endpoint: " + op.id))
- .asInstanceOf[Endpoint[I, E, O, SI, SO]]
- val input = op.data
- (input, endpoint)
- }
+ def input[I, E, O, SI, SO](op: DynamicOp[I, E, O, SI, SO]): I = op.data
+ def ordinal[I, E, O, SI, SO](op: DynamicOp[I, E, O, SI, SO]): Int =
+ ordinalMap(op.id)
}
diff --git a/modules/dynamic/test/src/smithy4s/dynamic/FieldsSpec.scala b/modules/dynamic/test/src/smithy4s/dynamic/FieldsSpec.scala
index c887d5a6b..a8acd5e65 100644
--- a/modules/dynamic/test/src/smithy4s/dynamic/FieldsSpec.scala
+++ b/modules/dynamic/test/src/smithy4s/dynamic/FieldsSpec.scala
@@ -57,35 +57,11 @@ class FieldsSpec() extends munit.FunSuite {
override def lazily[A](suspend: Lazy[Schema[A]]): ToFieldNames[A] =
() => apply(suspend.value)()
- // these will be needed later but are irrelevant for now
- // override def union[S](
- // first: Alt[ToFieldNames, S, _],
- // rest: Vector[Alt[ToFieldNames, S, _]]
- // )(total: S => Alt.WithValue[ToFieldNames, S, _]): ToFieldNames[S] =
- // () =>
- // first.label :: first.instance() ::: rest.flatMap { a =>
- // a.label :: a.instance()
- // }.toList
-
- // override def list[S](fs: ToFieldNames[S]): ToFieldNames[List[S]] = fs
- // override def vector[S](fs: ToFieldNames[S]): ToFieldNames[Vector[S]] = fs
- // override def map[K, V](
- // fk: ToFieldNames[K],
- // fv: ToFieldNames[V]
- // ): ToFieldNames[Map[K, V]] = () => fk() ++ fv()
- // override def bijection[A, B](
- // f: ToFieldNames[A],
- // to: A => B,
- // from: B => A
- // ): ToFieldNames[B] = f
-
- // override def set[S](fs: ToFieldNames[S]): ToFieldNames[Set[S]] = fs
-
}
def toFieldNames[Alg[_[_, _, _, _, _]]](
svc: Service[Alg]
- ): List[String] =
+ ): IndexedSeq[String] =
svc.endpoints.flatMap { endpoint =>
endpoint.input.compile(GetFieldNames)() ++
endpoint.output.compile(GetFieldNames)()
diff --git a/modules/http4s-kernel/src/smithy4s/http4s/kernel/ResponseEncoder.scala b/modules/http4s-kernel/src/smithy4s/http4s/kernel/ResponseEncoder.scala
index 3637cf4a5..80acdd7b0 100644
--- a/modules/http4s-kernel/src/smithy4s/http4s/kernel/ResponseEncoder.scala
+++ b/modules/http4s-kernel/src/smithy4s/http4s/kernel/ResponseEncoder.scala
@@ -51,7 +51,7 @@ object ResponseEncoder {
): ResponseEncoder[F, E] = {
val errorUnionSchema = errorable.error
val dispatcher =
- Alt.Dispatcher(errorUnionSchema.alternatives, errorUnionSchema.dispatch)
+ Alt.Dispatcher(errorUnionSchema.alternatives, errorUnionSchema.ordinal)
val precompiler = new Alt.Precompiler[ResponseEncoder[F, *]] {
def apply[Err](
label: String,
diff --git a/modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sRouter.scala b/modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sRouter.scala
index f5e72e801..a294cf40c 100644
--- a/modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sRouter.scala
+++ b/modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sRouter.scala
@@ -45,7 +45,7 @@ private[http4s] class SmithyHttp4sRouter[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _
// format: on
private val http4sEndpoints: List[SmithyHttp4sServerEndpoint[F]] =
- service.endpoints
+ service.endpoints.toList
.map { ep =>
SmithyHttp4sServerEndpoint.make(
impl,
diff --git a/modules/json/test/src/smithy4s/json/SchemaVisitorJCodecTests.scala b/modules/json/test/src/smithy4s/json/SchemaVisitorJCodecTests.scala
index 657885e9b..5a776c26d 100644
--- a/modules/json/test/src/smithy4s/json/SchemaVisitorJCodecTests.scala
+++ b/modules/json/test/src/smithy4s/json/SchemaVisitorJCodecTests.scala
@@ -95,21 +95,18 @@ class SchemaVisitorJCodecTests() extends FunSuite {
implicit val eitherBazBinSchema: Schema[Either[Baz, Bin]] = {
val left = struct(string.required[Baz]("str", _.str))(Baz.apply)
- .oneOf[Either[Baz, Bin]]("baz", (f: Baz) => Left(f))
val right = struct(
string.required[Bin]("str", _.str).addHints(JsonName("binStr")),
int.required[Bin]("int", _.int)
)(Bin.apply)
- .oneOf[Either[Baz, Bin]]("bin", (b: Bin) => Right(b))
- .addHints(JsonName("binBin"))
-
- union(left, right) {
- case Left(f) => left(f)
- case Right(b) => right(b)
- }.addHints(
- Discriminated("type")
- )
+ .addMemberHints(JsonName("binBin"))
+
+ Schema
+ .either(left, right)
+ .addHints(
+ Discriminated("type")
+ )
}
test(
@@ -201,19 +198,11 @@ class SchemaVisitorJCodecTests() extends FunSuite {
}
implicit val eitherIntStringSchema: Schema[Either[Int, String]] = {
- val left = int.oneOf[Either[Int, String]]("int", (int: Int) => Left(int))
- val right =
- string
- .oneOf[Either[Int, String]]("string", (str: String) => Right(str))
- .addHints(JsonName("_string"))
- union(left, right) {
- case Left(i) => left(i)
- case Right(str) => right(str)
- }
+ Schema.either(int, string.addMemberHints(JsonName("_string")))
}
test("Union gets encoded correctly") {
- val jsonInt = """{"int":1}"""
+ val jsonInt = """{"left":1}"""
val jsonStr = """{"_string":"foo"}"""
val int = writeToString[Either[Int, String]](Left(1))
val str = writeToString[Either[Int, String]](Right("foo"))
@@ -252,7 +241,7 @@ class SchemaVisitorJCodecTests() extends FunSuite {
}
test("Discriminated union gets encoded correctly") {
- val jsonBaz = """{"type":"baz","str":"test"}"""
+ val jsonBaz = """{"type":"left","str":"test"}"""
val jsonBin = """{"type":"binBin","binStr":"foo","int":2022}"""
val baz = writeToString[Either[Baz, Bin]](Left(Baz("test")))
val bin = writeToString[Either[Baz, Bin]](Right(Bin("foo", 2022)))
@@ -285,7 +274,7 @@ class SchemaVisitorJCodecTests() extends FunSuite {
}
test("Discriminated union gets routed to the correct codec") {
- val jsonBaz = """{"type":"baz","str":"test"}"""
+ val jsonBaz = """{"type":"left","str":"test"}"""
val jsonBin = """{"type":"binBin","binStr":"foo","int":2022}"""
val baz = readFromString[Either[Baz, Bin]](jsonBaz)
val bin = readFromString[Either[Baz, Bin]](jsonBin)
@@ -294,7 +283,7 @@ class SchemaVisitorJCodecTests() extends FunSuite {
}
test("Union gets routed to the correct codec") {
- val jsonInt = """{"int": 1}"""
+ val jsonInt = """{"left": 1}"""
val jsonStr = """{"_string": "foo"}"""
val int = readFromString[Either[Int, String]](jsonInt)
val str = readFromString[Either[Int, String]](jsonStr)
@@ -303,13 +292,13 @@ class SchemaVisitorJCodecTests() extends FunSuite {
}
test("Union: path gets surfaced in errors") {
- val json = """{"int": null}"""
+ val json = """{"left": null}"""
try {
val _ = readFromString[Either[Int, String]](json)
fail("Unexpected success")
} catch {
case PayloadError(path, expected, msg) =>
- expect.same(path, PayloadPath("int"))
+ expect.same(path, PayloadPath("left"))
expect.same(expected, "int")
expect(msg.contains("illegal number"))
diff --git a/modules/scalacheck/src/smithy4s/scalacheck/SchemaGenerator.scala b/modules/scalacheck/src/smithy4s/scalacheck/SchemaGenerator.scala
index 7190ceb70..4a5eb6682 100644
--- a/modules/scalacheck/src/smithy4s/scalacheck/SchemaGenerator.scala
+++ b/modules/scalacheck/src/smithy4s/scalacheck/SchemaGenerator.scala
@@ -94,8 +94,8 @@ class SchemaGenerator(maxWidth: Int) {
.map(_.toVector)
.map(distinctBy(_)(_.label).toVector)
} yield {
- union[DynAlt](alts: _*) { case (key: String, value) =>
- alts.find(_.label == key).get.apply(value)
+ union[DynAlt](alts: _*) { case (key: String, _) =>
+ alts.zipWithIndex.find(_._1.label == key).get._2
}
}
@@ -156,6 +156,11 @@ class SchemaGenerator(maxWidth: Int) {
for {
key <- Gen.identifier.map(_.take(8))
next <- recurse
- } yield Alt(key, next, (d: DynData) => (key, d))
+ } yield Alt(
+ key,
+ next,
+ (d: DynData) => (key, d),
+ { case (`key`, value) => value }
+ )
}
diff --git a/modules/test-utils/src/smithy4s/tests/DummyService.scala b/modules/test-utils/src/smithy4s/tests/DummyService.scala
index 56d7b87ab..df35912ff 100644
--- a/modules/test-utils/src/smithy4s/tests/DummyService.scala
+++ b/modules/test-utils/src/smithy4s/tests/DummyService.scala
@@ -30,15 +30,13 @@ object DummyService {
F: Applicative[F]
): FunctorAlgebra[Alg, F] = {
type Op[I, E, O, SI, SO] = service.Operation[I, E, O, SI, SO]
- service.fromPolyFunction[Kind1[F]#toKind5] {
- service.opToEndpoint.andThen[Kind1[F]#toKind5](
- new PolyFunction5[service.Endpoint, Kind1[F]#toKind5] {
- def apply[I, E, O, SI, SO](
- ep: Endpoint[Op, I, E, O, SI, SO]
- ): F[O] =
- F.pure(ep.output.compile(DefaultSchemaVisitor))
- }
- )
+ service.impl[F] {
+ new PolyFunction5[service.Endpoint, Kind1[F]#handler] {
+ def apply[I, E, O, SI, SO](
+ ep: Endpoint[Op, I, E, O, SI, SO]
+ ): I => F[O] =
+ _ => F.pure(ep.output.compile(DefaultSchemaVisitor))
+ }
}
}
}
diff --git a/modules/xml/test/src/smithy4s/xml/XmlCodecSpec.scala b/modules/xml/test/src/smithy4s/xml/XmlCodecSpec.scala
index d71f7f9dc..8444a3968 100644
--- a/modules/xml/test/src/smithy4s/xml/XmlCodecSpec.scala
+++ b/modules/xml/test/src/smithy4s/xml/XmlCodecSpec.scala
@@ -325,14 +325,7 @@ object XmlCodecSpec extends SimpleIOSuite {
test("union") {
type Foo = Either[Int, String]
- implicit val schema: Schema[Foo] = {
- val left = int.oneOf[Foo]("left", Left(_))
- val right = string.oneOf[Foo]("right", Right(_))
- union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }.n
- }
+ implicit val schema: Schema[Foo] = Schema.either(int, string).n
val xmlLeft = """1"""
val xmlRight = """hello""".stripMargin
checkContent[Foo](xmlLeft, Left(1)) |+|
@@ -354,8 +347,8 @@ object XmlCodecSpec extends SimpleIOSuite {
val baz =
int.biject[Foo.Baz](Foo.Baz(_), (_: Foo.Baz).int).oneOf[Foo]("baz")
union(bar, baz) {
- case b: Foo.Bar => bar(b)
- case b: Foo.Baz => baz(b)
+ case _: Foo.Bar => 0
+ case _: Foo.Baz => 1
}.n
}
}
@@ -371,12 +364,9 @@ object XmlCodecSpec extends SimpleIOSuite {
test("union: custom names") {
type Foo = Either[Int, String]
implicit val schema: Schema[Foo] = {
- val left = int.oneOf[Foo]("left", Left(_)).addHints(XmlName("foo"))
- val right = string.oneOf[Foo]("right", Right(_)).addHints(XmlName("bar"))
- union(left, right) {
- case Left(int) => left(int)
- case Right(string) => right(string)
- }.n
+ val left = int.addHints(XmlName("foo"))
+ val right = string.addHints(XmlName("bar"))
+ Schema.either(left, right).n
}
val xmlLeft = """1"""
val xmlRight = """hello""".stripMargin
diff --git a/project/Boilerplate.scala b/project/Boilerplate.scala
index 74d99ae61..370b534eb 100644
--- a/project/Boilerplate.scala
+++ b/project/Boilerplate.scala
@@ -34,7 +34,7 @@ object Boilerplate {
case object Core3 extends BoilerplateModule
def templates: Map[BoilerplateModule, List[Template]] = Map(
- Core -> List(PartiallyAppliedStruct, PolyFunction),
+ Core -> List(PartiallyAppliedStruct, PartiallyAppliedTuple, PolyFunction),
Core2 -> List(Scala2Kinds, FunctorK(Scala2)),
Core3 -> List(Scala3Kinds, FunctorK(Scala3))
)
@@ -147,7 +147,7 @@ object Boilerplate {
import tv._
val fields = synTypes.map { tpe =>
- s"Field[F, S, $tpe]"
+ s"Field[S, $tpe]"
}
val schemaFields = synTypes.map { tpe =>
@@ -201,6 +201,57 @@ object Boilerplate {
"""
}
}
+
+ object PartiallyAppliedTuple extends Template {
+ override def range: IndexedSeq[Int] = 2 to 22
+
+ override def filename(root: File): File =
+ root / "generated" / "schema" / "PartiallyAppliedTuple.scala"
+
+ override def content(tv: TemplateVals): String = {
+ import tv._
+
+ // val params =
+ // synVals.zip(fields).map { case (v, t) => s"$v: $t" }.mkString(", ")
+
+ val schemaParams =
+ synVals
+ .zip(synTypes)
+ .map { case (v, t) => s"$v: Schema[$t]" }
+ .mkString(", ")
+
+ val tupleAccessors = (0 until arity).map(n => s"_${n + 1}")
+
+ val fields = synVals
+ .zip(tupleAccessors)
+ .map { case (schema, accessor) =>
+ s"""$schema.required[${`(A..N)`}]("$accessor", _.$accessor)"""
+ }
+ .mkString(", ")
+
+ val consArgs = synVals.map(v => s"_$v").mkString(", ")
+
+ val casts = synTypes.zipWithIndex
+ .map { case (a, i) =>
+ s"arr($i).asInstanceOf[${a}]"
+ }
+ .mkString(", ")
+
+ val smartCtsr =
+ s"""def apply[${`A..N`}]($schemaParams): Schema.StructSchema[${`(A..N)`}] = Schema.StructSchema[${`(A..N)`}](placeholder, Hints.empty, Vector($fields), arr => ($casts))"""
+
+ block"""
+ |package smithy4s
+ |package schema
+ |
+ |class PartiallyAppliedTuple protected[schema](placeholder: ShapeId) {
+ |
+ - $smartCtsr
+ |
+ |}
+ """
+ }
+ }
object PolyFunction extends Template {
override val range: IndexedSeq[Int] = IndexedSeq(1, 2, 5)
override def filename(root: File): File =
@@ -222,21 +273,6 @@ object Boilerplate {
- final def andThen[H[${`_.._`}]](other: PolyFunction$suffix[G, H]): PolyFunction$suffix[F, H] = new PolyFunction$suffix[F, H]{
- def apply[${`A..N`}](fa: F[${`A..N`}]): H[${`A..N`}] = other(self(fa))
- }
- -
- - import Kind$arity._
- - private[smithy4s] final def unsafeCacheBy[K](allPossibleInputs: Seq[Existential[F]], getKey: Existential[F] => K): PolyFunction$suffix[F, G] =
- - new PolyFunction$suffix[F, G] {
- - private val map: Map[K, Any] = {
- - val builder = Map.newBuilder[K, Any]
- - allPossibleInputs.foreach(input =>
- - builder += getKey(input) -> self
- - .apply(input.asInstanceOf[F[${`Any..Any`}]])
- - .asInstanceOf[Any]
- - )
- - builder.result()
- - }
- - def apply[${`A..N`}](input: F[${`A..N`}]): G[${`A..N`}] = map(getKey(existential(input))).asInstanceOf[G[${`A..N`}]]
- - }
-}
-object PolyFunction$suffix{
- type From[F[${`_.._`}]] = {