diff --git a/buildDeps.sc b/buildDeps.sc index 230b05a..8dbd8b3 100644 --- a/buildDeps.sc +++ b/buildDeps.sc @@ -3,7 +3,7 @@ import mill.define._ import mill.scalalib._ object alloy { - val alloyVersion = "0.3.4" + val alloyVersion = "0.3.9" val core = ivy"com.disneystreaming.alloy:alloy-core:$alloyVersion" val protobuf = @@ -25,7 +25,7 @@ object swagger { ) } object smithy { - val smithyVersion = "1.41.1" + val smithyVersion = "1.49.0" val model = ivy"software.amazon.smithy:smithy-model:$smithyVersion" val build = ivy"software.amazon.smithy:smithy-build:$smithyVersion" val diff = ivy"software.amazon.smithy:smithy-diff:$smithyVersion" diff --git a/modules/openapi/tests/resources/issue-23.json b/modules/openapi/tests/resources/issue-23.json index d35b11b..09b88ef 100644 --- a/modules/openapi/tests/resources/issue-23.json +++ b/modules/openapi/tests/resources/issue-23.json @@ -15,7 +15,7 @@ } ], "paths": { - "/Testers/{id}": { + "/Testers/{id_}": { "get": { "tags": ["Testers"], "summary": "Testers_GetTest", diff --git a/modules/proto/src/smithytranslate/proto3/internals/Compiler.scala b/modules/proto/src/smithytranslate/proto3/internals/Compiler.scala index 2227f00..e46a1a4 100644 --- a/modules/proto/src/smithytranslate/proto3/internals/Compiler.scala +++ b/modules/proto/src/smithytranslate/proto3/internals/Compiler.scala @@ -452,9 +452,16 @@ private[proto3] class Compiler(model: Model, allShapes: Boolean) { val isMap = targetShape.isMapShape() memberHasWrapped || targetHasWrapped || isList || isMap } + val maybeTimestampFormat = extractTimestampFormat(m) val fieldType = targetShape - .accept(typeVisitor(isWrapped = isWrapped, numType)) + .accept( + typeVisitor( + isWrapped = isWrapped, + numType, + maybeTimestampFormat + ) + ) .get val isDeprecated = m.hasTrait(classOf[DeprecatedTrait]) Field( diff --git a/modules/proto/tests/src/smithytranslate/proto3/internals/CompilerRendererSuite.scala b/modules/proto/tests/src/smithytranslate/proto3/internals/CompilerRendererSuite.scala index 76577a4..ce2695f 100644 --- a/modules/proto/tests/src/smithytranslate/proto3/internals/CompilerRendererSuite.scala +++ b/modules/proto/tests/src/smithytranslate/proto3/internals/CompilerRendererSuite.scala @@ -67,6 +67,36 @@ class CompilerRendererSuite extends FunSuite { convertCheck(source, Map("com/example/example.proto" -> expected)) } + test("top level - union with timestamp formats") { + val source = """|namespace com.example + | + |use alloy.proto#protoTimestampFormat + | + |union MyUnion { + | one: Timestamp + | @protoTimestampFormat("EPOCH_MILLIS") + | two: Timestamp + |} + |""".stripMargin + + val expected = """|syntax = "proto3"; + | + |package com.example; + | + |import "google/protobuf/timestamp.proto"; + | + |import "alloy/protobuf/types.proto"; + | + |message MyUnion { + | oneof definition { + | google.protobuf.Timestamp one = 1; + | alloy.protobuf.EpochMillisTimestamp two = 2; + | } + |} + |""".stripMargin + convertCheck(source, Map("com/example/example.proto" -> expected)) + } + test("@protoInlinedOneOf union - used within only one data structure") { val source = """|namespace com.example |