Skip to content

Commit 4644a61

Browse files
authored
Merge pull request #1898 from disneystreaming/copilot/fix-long-value-renderer
Fix Long literal rendering to add `L` suffix
2 parents 6f8d499 + 44f0529 commit 4644a61

21 files changed

+44
-35
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ When adding entries, please treat them as if they could end up in a release any
55

66
Thank you!
77

8+
# 0.18.49
9+
10+
* 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)
11+
12+
# 0.18.48
13+
14+
* codegen: Update codegen of numbers when using dynamic bindings in [#1886](https://github.com/disneystreaming/smithy4s/pull/1886)
15+
* codegen: Add type params to `struct` and `union` in codegen schemas in [#1893](https://github.com/disneystreaming/smithy4s/pull/1893)
16+
817
# 0.18.47
918

1019
* core: Add `asSurjection` method to `ValidatedNewtype` class (see [#1873](https://github.com/disneystreaming/smithy4s/pull/1873))

modules/bootstrapped/src/generated/com/amazonaws/dynamodb/Endpoint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ object Endpoint extends ShapeTag.Companion[Endpoint] {
2929

3030
implicit val schema: Schema[Endpoint] = struct[Endpoint](
3131
string.required[Endpoint]("Address", _.address).addHints(smithy.api.Documentation("<p>IP address of the endpoint.</p>")),
32-
long.required[Endpoint]("CachePeriodInMinutes", _.cachePeriodInMinutes).addHints(smithy.api.Default(smithy4s.Document.fromLong(0)), smithy.api.Documentation("<p>Endpoint cache time to live (TTL) value.</p>")),
32+
long.required[Endpoint]("CachePeriodInMinutes", _.cachePeriodInMinutes).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L)), smithy.api.Documentation("<p>Endpoint cache time to live (TTL) value.</p>")),
3333
)(make).withId(id).addHints(hints)
3434
}

modules/bootstrapped/src/generated/smithy4s/example/ArbitraryDataTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object ArbitraryDataTest extends ShapeTag.Companion[ArbitraryDataTest] {
1212
val id: ShapeId = ShapeId("smithy4s.example", "ArbitraryDataTest")
1313

1414
val hints: Hints = Hints(
15-
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)))),
15+
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)))),
1616
).lazily
1717

1818

modules/bootstrapped/src/generated/smithy4s/example/ChanceOfRain.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import smithy4s.schema.Schema.float
1010
object ChanceOfRain extends Newtype[Float] {
1111
val id: ShapeId = ShapeId("smithy4s.example", "ChanceOfRain")
1212
val hints: Hints = Hints(
13-
smithy.api.Default(smithy4s.Document.fromLong(0)),
13+
smithy.api.Default(smithy4s.Document.fromLong(0L)),
1414
).lazily
1515
val underlyingSchema: Schema[Float] = float.withId(id).addHints(hints)
1616
implicit val schema: Schema[ChanceOfRain] = bijection(underlyingSchema, asBijection)

modules/bootstrapped/src/generated/smithy4s/example/DefaultOrderingTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object DefaultOrderingTest extends ShapeTag.Companion[DefaultOrderingTest] {
1919
private def make(one: Int, two: Option[String], three: String): DefaultOrderingTest = DefaultOrderingTest(three, one, two)
2020

2121
implicit val schema: Schema[DefaultOrderingTest] = struct[DefaultOrderingTest](
22-
int.field[DefaultOrderingTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
22+
int.field[DefaultOrderingTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
2323
string.optional[DefaultOrderingTest]("two", _.two),
2424
string.required[DefaultOrderingTest]("three", _.three),
2525
)(make).withId(id).addHints(hints)

modules/bootstrapped/src/generated/smithy4s/example/DefaultTest.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ object DefaultTest extends ShapeTag.Companion[DefaultTest] {
3131
private def make(one: Int, two: String, three: List[String], four: List[String], five: String, six: Int, seven: Document, eight: Map[String, String], nine: Short, ten: Double, eleven: Float, twelve: Long, thirteen: Timestamp, fourteen: Timestamp, fifteen: Timestamp, sixteen: Byte, seventeen: Blob, eighteen: Boolean): DefaultTest = DefaultTest(one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen)
3232

3333
implicit val schema: Schema[DefaultTest] = struct[DefaultTest](
34-
int.field[DefaultTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
34+
int.field[DefaultTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
3535
string.field[DefaultTest]("two", _.two).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))),
3636
StringList.underlyingSchema.field[DefaultTest]("three", _.three).addHints(smithy.api.Default(smithy4s.Document.array())),
3737
StringList.underlyingSchema.field[DefaultTest]("four", _.four).addHints(smithy.api.Default(smithy4s.Document.array())),
3838
string.field[DefaultTest]("five", _.five).addHints(smithy.api.Default(smithy4s.Document.fromString(""))),
39-
int.field[DefaultTest]("six", _.six).addHints(smithy.api.Default(smithy4s.Document.fromLong(0))),
39+
int.field[DefaultTest]("six", _.six).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L))),
4040
document.field[DefaultTest]("seven", _.seven).addHints(smithy.api.Default(smithy4s.Document.nullDoc)),
4141
DefaultStringMap.underlyingSchema.field[DefaultTest]("eight", _.eight).addHints(smithy.api.Default(smithy4s.Document.obj())),
42-
short.field[DefaultTest]("nine", _.nine).addHints(smithy.api.Default(smithy4s.Document.fromLong(0))),
42+
short.field[DefaultTest]("nine", _.nine).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L))),
4343
double.field[DefaultTest]("ten", _.ten).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d))),
4444
float.field[DefaultTest]("eleven", _.eleven).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d))),
45-
long.field[DefaultTest]("twelve", _.twelve).addHints(smithy.api.Default(smithy4s.Document.fromLong(0))),
46-
timestamp.field[DefaultTest]("thirteen", _.thirteen).addHints(smithy.api.Default(smithy4s.Document.fromLong(0))),
45+
long.field[DefaultTest]("twelve", _.twelve).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L))),
46+
timestamp.field[DefaultTest]("thirteen", _.thirteen).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L))),
4747
timestamp.field[DefaultTest]("fourteen", _.fourteen).addHints(smithy.api.Default(smithy4s.Document.fromString("Thu, 01 Jan 1970 00:00:00 GMT")), smithy.api.TimestampFormat.HTTP_DATE.widen),
4848
timestamp.field[DefaultTest]("fifteen", _.fifteen).addHints(smithy.api.Default(smithy4s.Document.fromString("1970-01-01T00:00:00.00Z")), smithy.api.TimestampFormat.DATE_TIME.widen),
49-
byte.field[DefaultTest]("sixteen", _.sixteen).addHints(smithy.api.Default(smithy4s.Document.fromLong(0))),
49+
byte.field[DefaultTest]("sixteen", _.sixteen).addHints(smithy.api.Default(smithy4s.Document.fromLong(0L))),
5050
bytes.field[DefaultTest]("seventeen", _.seventeen).addHints(smithy.api.Default(smithy4s.Document.fromString(""))),
5151
boolean.field[DefaultTest]("eighteen", _.eighteen).addHints(smithy.api.Default(smithy4s.Document.fromBoolean(false))),
5252
)(make).withId(id).addHints(hints)

modules/bootstrapped/src/generated/smithy4s/example/HealthResponse.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object HealthResponse extends ShapeTag.Companion[HealthResponse] {
1313
val id: ShapeId = ShapeId("smithy4s.example", "HealthResponse")
1414

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

1919
// constructor using the original order from the spec

modules/bootstrapped/src/generated/smithy4s/example/Numeric.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import smithy4s.schema.Schema.long
1313
import smithy4s.schema.Schema.short
1414
import smithy4s.schema.Schema.struct
1515

16-
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))
16+
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))
1717

1818
object Numeric extends ShapeTag.Companion[Numeric] {
1919
val id: ShapeId = ShapeId("smithy4s.example", "Numeric")
@@ -24,12 +24,12 @@ object Numeric extends ShapeTag.Companion[Numeric] {
2424
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)
2525

2626
implicit val schema: Schema[Numeric] = struct[Numeric](
27-
int.field[Numeric]("i", _.i).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
27+
int.field[Numeric]("i", _.i).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
2828
float.field[Numeric]("f", _.f).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))),
2929
double.field[Numeric]("d", _.d).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))),
30-
short.field[Numeric]("s", _.s).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
31-
long.field[Numeric]("l", _.l).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
32-
bigint.field[Numeric]("bi", _.bi).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
33-
bigdecimal.field[Numeric]("bd", _.bd).addHints(smithy.api.Default(smithy4s.Document.fromLong(1))),
30+
short.field[Numeric]("s", _.s).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
31+
long.field[Numeric]("l", _.l).addHints(smithy.api.Default(smithy4s.Document.fromLong(9999999999L))),
32+
bigint.field[Numeric]("bi", _.bi).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
33+
bigdecimal.field[Numeric]("bd", _.bd).addHints(smithy.api.Default(smithy4s.Document.fromLong(1L))),
3434
)(make).withId(id).addHints(hints)
3535
}

modules/bootstrapped/src/generated/smithy4s/example/PatchableEdgeCases.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ object PatchableEdgeCases extends ShapeTag.Companion[PatchableEdgeCases] {
2121

2222
implicit val schema: Schema[PatchableEdgeCases] = struct[PatchableEdgeCases](
2323
int.nullable.required[PatchableEdgeCases]("required", _.required),
24-
int.nullable.required[PatchableEdgeCases]("requiredDefaultValue", _.requiredDefaultValue).addHints(smithy.api.Default(smithy4s.Document.fromLong(3))),
24+
int.nullable.required[PatchableEdgeCases]("requiredDefaultValue", _.requiredDefaultValue).addHints(smithy.api.Default(smithy4s.Document.fromLong(3L))),
2525
int.nullable.required[PatchableEdgeCases]("requiredDefaultNull", _.requiredDefaultNull).addHints(smithy.api.Default(smithy4s.Document.nullDoc)),
26-
int.nullable.field[PatchableEdgeCases]("defaultValue", _.defaultValue).addHints(smithy.api.Default(smithy4s.Document.fromLong(5))),
26+
int.nullable.field[PatchableEdgeCases]("defaultValue", _.defaultValue).addHints(smithy.api.Default(smithy4s.Document.fromLong(5L))),
2727
int.nullable.field[PatchableEdgeCases]("defaultNull", _.defaultNull).addHints(smithy.api.Default(smithy4s.Document.nullDoc)),
2828
)(make).withId(id).addHints(hints)
2929
}

modules/bootstrapped/src/generated/smithy4s/example/ShouldHaveDynamicBinding.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ object ShouldHaveDynamicBinding extends ShapeTag.Companion[ShouldHaveDynamicBind
1515
val hints: Hints = Hints(
1616
smithy.api.Since("1"),
1717
Hints.dynamic(ShapeId("smithy4s.example", "testDynamicBinding"), smithy4s.Document.obj("str" -> smithy4s.Document.fromString("test"))),
18-
Hints.dynamic(ShapeId("smithy4s.example.dynamic_traits", "thisWillBeDynamic"), smithy4s.Document.obj("test" -> smithy4s.Document.fromLong(101), "test2" -> smithy4s.Document.fromDouble(123.456d))),
18+
Hints.dynamic(ShapeId("smithy4s.example.dynamic_traits", "thisWillBeDynamic"), smithy4s.Document.obj("test" -> smithy4s.Document.fromLong(101L), "test2" -> smithy4s.Document.fromDouble(123.456d))),
1919
).lazily
2020

2121
// constructor using the original order from the spec
2222
private def make(a: Option[String], b: Option[String]): ShouldHaveDynamicBinding = ShouldHaveDynamicBinding(a, b)
2323

2424
implicit val schema: Schema[ShouldHaveDynamicBinding] = struct[ShouldHaveDynamicBinding](
25-
string.optional[ShouldHaveDynamicBinding]("a", _.a).addHints(smithy.api.Since("2"), Hints.dynamic(ShapeId("smithy4s.example", "testDynamicBinding"), smithy4s.Document.obj("str" -> smithy4s.Document.fromString("test2"), "int" -> smithy4s.Document.fromLong(1234)))),
25+
string.optional[ShouldHaveDynamicBinding]("a", _.a).addHints(smithy.api.Since("2"), Hints.dynamic(ShapeId("smithy4s.example", "testDynamicBinding"), smithy4s.Document.obj("str" -> smithy4s.Document.fromString("test2"), "int" -> smithy4s.Document.fromLong(1234L)))),
2626
string.validated(smithy.api.Length(min = Some(1L), max = None)).optional[ShouldHaveDynamicBinding]("b", _.b).addHints(Hints.dynamic(ShapeId("smithy4s.example", "testDynamicBinding"), smithy4s.Document.obj())),
2727
)(make).withId(id).addHints(hints)
2828
}

0 commit comments

Comments
 (0)