Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ Prevents using it as an implicit conversion in Scala 2

The handwritten Java `TraitService` implementations for all smithy4s meta traits in the protocol module have been removed and are now generated by smithy4s itself. This should not affect users who are not programmatically using those traits directly. (see [#1901](https://github.com/disneystreaming/smithy4s/pull/1901))

# 0.18.49

* mill codegen plugin: now supports Mill 1.x (tested with 1.1.1), in addition to the existing Mill 0.11.x and 0.12.x support
* codegen: Cross comple codegen module against Scala 3
* codegen: Fix `Long` literal rendering to add `L` suffix, preventing `integer number too large` compilation errors for values exceeding `Int.MaxValue` in [#1898](https://github.com/disneystreaming/smithy4s/pull/1898)

# 0.18.48

* codegen: Update codegen of numbers when using dynamic bindings in [#1886](https://github.com/disneystreaming/smithy4s/pull/1886)
* codegen: Add type params to `struct` and `union` in codegen schemas in [#1893](https://github.com/disneystreaming/smithy4s/pull/1893)

# 0.18.47

* core: Add `asSurjection` method to `ValidatedNewtype` class (see [#1873](https://github.com/disneystreaming/smithy4s/pull/1873))
Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ lazy val codegen = projectMatrix
Dependencies.Circe.parser.value,
Dependencies.Circe.generic.value,
("io.get-coursier" %% "coursier" % "2.1.24")
.cross(CrossVersion.for3Use2_13)
.cross(CrossVersion.for3Use2_13),
Dependencies.Mima.core % Test
),
libraryDependencies ++= {
if (scalaVersion.value.startsWith("2."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ object Endpoint extends ShapeTag.Companion[Endpoint] {

implicit val schema: Schema[Endpoint] = struct[Endpoint](
string.required[Endpoint]("Address", _.address).addHints(Hints.dynamic(ShapeId("smithy.api", "documentation"), smithy4s.Document.fromString("<p>IP address of the endpoint.</p>"))),
long.required[Endpoint]("CachePeriodInMinutes", _.cachePeriodInMinutes).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(0)), Hints.dynamic(ShapeId("smithy.api", "documentation"), smithy4s.Document.fromString("<p>Endpoint cache time to live (TTL) value.</p>"))),
long.required[Endpoint]("CachePeriodInMinutes", _.cachePeriodInMinutes).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(0L)), Hints.dynamic(ShapeId("smithy.api", "documentation"), smithy4s.Document.fromString("<p>Endpoint cache time to live (TTL) value.</p>"))),
)(make).withId(id).addHints(hints)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object InvalidEndpointException extends ShapeTag.Companion[InvalidEndpointExcept

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("client")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(421)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(421L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object BenchmarkServiceOperation {
val schema: OperationSchema[SendStringInput, Nothing, Unit, Nothing, Nothing] = Schema.operation(ShapeId("smithy4s.benchmark", "SendString"))
.withInput(SendStringInput.schema)
.withOutput(unit)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/simple/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200))))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/simple/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200L))))
def wrap(input: SendStringInput): SendString = SendString(input)
}
final case class CreateObject(input: CreateObjectInput) extends BenchmarkServiceOperation[CreateObjectInput, Nothing, Unit, Nothing, Nothing] {
Expand All @@ -110,7 +110,7 @@ object BenchmarkServiceOperation {
val schema: OperationSchema[CreateObjectInput, Nothing, Unit, Nothing, Nothing] = Schema.operation(ShapeId("smithy4s.benchmark", "CreateObject"))
.withInput(CreateObjectInput.schema)
.withOutput(unit)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/complex/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200))))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/complex/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200L))))
def wrap(input: CreateObjectInput): CreateObject = CreateObject(input)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object ArbitraryDataTest extends ShapeTag.Companion[ArbitraryDataTest] {
val id: ShapeId = ShapeId("smithy4s.example", "ArbitraryDataTest")

val hints: Hints = Hints(
smithy4s.example.ArbitraryData(smithy4s.Document.obj("str" -> smithy4s.Document.fromString("hello"), "int" -> smithy4s.Document.fromLong(1), "bool" -> smithy4s.Document.fromBoolean(true), "arr" -> smithy4s.Document.array(smithy4s.Document.fromString("one"), smithy4s.Document.fromString("two"), smithy4s.Document.fromString("three")), "obj" -> smithy4s.Document.obj("str" -> smithy4s.Document.fromString("s"), "i" -> smithy4s.Document.fromLong(1)))),
smithy4s.example.ArbitraryData(smithy4s.Document.obj("str" -> smithy4s.Document.fromString("hello"), "int" -> smithy4s.Document.fromLong(1L), "bool" -> smithy4s.Document.fromBoolean(true), "arr" -> smithy4s.Document.array(smithy4s.Document.fromString("one"), smithy4s.Document.fromString("two"), smithy4s.Document.fromString("three")), "obj" -> smithy4s.Document.obj("str" -> smithy4s.Document.fromString("s"), "i" -> smithy4s.Document.fromLong(1L)))),
).lazily


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object BrandServiceOperation {
val schema: OperationSchema[AddBrandsInput, Nothing, Unit, Nothing, Nothing] = Schema.operation(ShapeId("smithy4s.example", "AddBrands"))
.withInput(AddBrandsInput.schema)
.withOutput(unit)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/brands"), "code" -> smithy4s.Document.fromLong(200))))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("POST"), "uri" -> smithy4s.Document.fromString("/brands"), "code" -> smithy4s.Document.fromLong(200L))))
def wrap(input: AddBrandsInput): AddBrands = AddBrands(input)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import smithy4s.schema.Schema.float
object ChanceOfRain extends Newtype[Float] {
val id: ShapeId = ShapeId("smithy4s.example", "ChanceOfRain")
val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(0)),
Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(0L)),
)
val underlyingSchema: Schema[Float] = float.withId(id).addHints(hints)
implicit val schema: Schema[ChanceOfRain] = bijection(underlyingSchema, asBijection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object DefaultOrderingTest extends ShapeTag.Companion[DefaultOrderingTest] {
private def make(one: Int, two: Option[String], three: String): DefaultOrderingTest = DefaultOrderingTest(three, one, two)

implicit val schema: Schema[DefaultOrderingTest] = struct[DefaultOrderingTest](
int.field[DefaultOrderingTest]("one", _.one).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
int.field[DefaultOrderingTest]("one", _.one).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
string.optional[DefaultOrderingTest]("two", _.two),
string.required[DefaultOrderingTest]("three", _.three),
)(make).withId(id).addHints(hints)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object DefaultTest extends ShapeTag.Companion[DefaultTest] {
private def make(one: Int, two: String, three: List[String], four: Option[List[String]], five: Option[String], six: Option[Int], seven: Option[Document], eight: Option[Map[String, String]], nine: Option[Short], ten: Option[Double], eleven: Option[Float], twelve: Option[Long], thirteen: Option[Timestamp], fourteen: Option[Timestamp], fifteen: Option[Timestamp], sixteen: Option[Byte], seventeen: Option[Blob], eighteen: Option[Boolean], nineteen: Nullable[Int], twenty: Nullable[Int]): DefaultTest = DefaultTest(one, two, three, nineteen, twenty, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen)

implicit val schema: Schema[DefaultTest] = struct[DefaultTest](
int.field[DefaultTest]("one", _.one).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
int.field[DefaultTest]("one", _.one).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
string.field[DefaultTest]("two", _.two).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromString("test"))),
StringList.underlyingSchema.field[DefaultTest]("three", _.three).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.array())),
StringList.underlyingSchema.optional[DefaultTest]("four", _.four).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.nullDoc)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ object DiscriminatedServiceOperation {
val schema: OperationSchema[TestDiscriminatedInput, Nothing, TestDiscriminatedOutput, Nothing, Nothing] = Schema.operation(ShapeId("smithy4s.example", "TestDiscriminated"))
.withInput(TestDiscriminatedInput.schema)
.withOutput(TestDiscriminatedOutput.schema)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/test/{key}"), "code" -> smithy4s.Document.fromLong(200))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/test/{key}"), "code" -> smithy4s.Document.fromLong(200L))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
def wrap(input: TestDiscriminatedInput): TestDiscriminated = TestDiscriminated(input)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object EHNotFound extends ShapeTag.Companion[EHNotFound] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("client")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(404)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(404L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object EHServiceUnavailable extends ShapeTag.Companion[EHServiceUnavailable] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("server")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(503)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(503L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ object FooServiceOperation {
val schema: OperationSchema[Unit, Nothing, GetFooOutput, Nothing, Nothing] = Schema.operation(ShapeId("smithy4s.example", "GetFoo"))
.withInput(unit)
.withOutput(GetFooOutput.schema)
.withHints(Hints.dynamic(ShapeId("smithy.api", "documentation"), smithy4s.Document.fromString("Returns a useful Foo\nNo input necessary to find our Foo\nThe path for this operation is \"/foo\"")), Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/foo"), "code" -> smithy4s.Document.fromLong(200))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
.withHints(Hints.dynamic(ShapeId("smithy.api", "documentation"), smithy4s.Document.fromString("Returns a useful Foo\nNo input necessary to find our Foo\nThe path for this operation is \"/foo\"")), Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/foo"), "code" -> smithy4s.Document.fromLong(200L))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
def wrap(input: Unit): GetFoo = GetFoo()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object GenericClientError extends ShapeTag.Companion[GenericClientError] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("client")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(418)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(418L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object GenericServerError extends ShapeTag.Companion[GenericServerError] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("server")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(502)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(502L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object HealthResponse extends ShapeTag.Companion[HealthResponse] {
val id: ShapeId = ShapeId("smithy4s.example", "HealthResponse")

val hints: Hints = Hints(
smithy4s.example.FreeForm(smithy4s.Document.obj("i" -> smithy4s.Document.fromLong(1), "a" -> smithy4s.Document.fromLong(2))),
smithy4s.example.FreeForm(smithy4s.Document.obj("i" -> smithy4s.Document.fromLong(1L), "a" -> smithy4s.Document.fromLong(2L))),
).lazily

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object NoMoreSpace extends ShapeTag.Companion[NoMoreSpace] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("server")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(507)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(507L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object NotFoundError extends ShapeTag.Companion[NotFoundError] {

val hints: Hints = Hints(
Hints.dynamic(ShapeId("smithy.api", "error"), smithy4s.Document.fromString("client")),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(404)),
Hints.dynamic(ShapeId("smithy.api", "httpError"), smithy4s.Document.fromLong(404L)),
)

// constructor using the original order from the spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import smithy4s.schema.Schema.long
import smithy4s.schema.Schema.short
import smithy4s.schema.Schema.struct

final case class Numeric(i: Int = 1, f: Float = 1.0f, d: Double = 1.0d, s: Short = 1, l: Long = 1L, bi: BigInt = scala.math.BigInt(1), bd: BigDecimal = scala.math.BigDecimal(1.0))
final case class Numeric(i: Int = 1, f: Float = 1.0f, d: Double = 1.0d, s: Short = 1, l: Long = 9999999999L, bi: BigInt = scala.math.BigInt(1), bd: BigDecimal = scala.math.BigDecimal(1.0))

object Numeric extends ShapeTag.Companion[Numeric] {
val id: ShapeId = ShapeId("smithy4s.example", "Numeric")
Expand All @@ -24,12 +24,12 @@ object Numeric extends ShapeTag.Companion[Numeric] {
private def make(i: Int, f: Float, d: Double, s: Short, l: Long, bi: BigInt, bd: BigDecimal): Numeric = Numeric(i, f, d, s, l, bi, bd)

implicit val schema: Schema[Numeric] = struct[Numeric](
int.field[Numeric]("i", _.i).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
int.field[Numeric]("i", _.i).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
float.field[Numeric]("f", _.f).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromDouble(1.0d))),
double.field[Numeric]("d", _.d).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromDouble(1.0d))),
short.field[Numeric]("s", _.s).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
long.field[Numeric]("l", _.l).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
bigint.field[Numeric]("bi", _.bi).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
bigdecimal.field[Numeric]("bd", _.bd).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1))),
short.field[Numeric]("s", _.s).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
long.field[Numeric]("l", _.l).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(9999999999L))),
bigint.field[Numeric]("bi", _.bi).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
bigdecimal.field[Numeric]("bd", _.bd).addHints(Hints.dynamic(ShapeId("smithy.api", "default"), smithy4s.Document.fromLong(1L))),
)(make).withId(id).addHints(hints)
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ object ObjectServiceOperation {
.withInput(GetObjectInput.schema)
.withError(GetObjectError.errorSchema)
.withOutput(GetObjectOutput.schema)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("GET"), "uri" -> smithy4s.Document.fromString("/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200L))), Hints.dynamic(ShapeId("smithy.api", "readonly"), smithy4s.Document.obj()))
def wrap(input: GetObjectInput): GetObject = GetObject(input)
}
sealed trait GetObjectError extends scala.Product with scala.Serializable { self =>
Expand Down Expand Up @@ -193,7 +193,7 @@ object ObjectServiceOperation {
.withInput(PutObjectInput.schema)
.withError(PutObjectError.errorSchema)
.withOutput(unit)
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("PUT"), "uri" -> smithy4s.Document.fromString("/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200))), Hints.dynamic(ShapeId("smithy.api", "idempotent"), smithy4s.Document.obj()))
.withHints(Hints.dynamic(ShapeId("smithy.api", "http"), smithy4s.Document.obj("method" -> smithy4s.Document.fromString("PUT"), "uri" -> smithy4s.Document.fromString("/{bucketName}/{key}"), "code" -> smithy4s.Document.fromLong(200L))), Hints.dynamic(ShapeId("smithy.api", "idempotent"), smithy4s.Document.obj()))
def wrap(input: PutObjectInput): PutObject = PutObject(input)
}
sealed trait PutObjectError extends scala.Product with scala.Serializable { self =>
Expand Down
Loading