disneystreaming / smithy4s

https://disneystreaming.github.io/smithy4s/
Other
351 stars 72 forks source link

Error with Smithy4sCodegenPlugin and aws-sfn-spec: Incorrect package members for CloudWatchEventsExecutionDataDetails and HistoryEventExecutionDataDetails #1592

Closed IRasmivan closed 2 months ago

IRasmivan commented 2 months ago

Description

I encountered an issue while adding the aws-sfn-spec dependency and enabling the Smithy4sCodegenPlugin. The generated files seem to reference incorrect package members, causing compilation errors.

Steps to Reproduce

  1. Added the following dependency to my build.sbt:

    "com.disneystreaming.smithy" % "aws-sfn-spec" % "2023.23.30"
  2. Enabled the Smithy4s plugin in my project:

    .enablePlugins(Smithy4sCodegenPlugin)
  3. Ran the SBT compile process.

Actual Behavior

During compilation, I encountered the following errors from generated code in the src_managed/main/smithy4s directory:

[error] /target/scala-2.13/src_managed/main/smithy4s/com/amazonaws/sfn/CloudWatchEventsExecutionDataDetails.scala:14:101: object includedDetails is not a member of package com.amazonaws.sfn
[error] did you mean IncludedDetails?
[error] final case class CloudWatchEventsExecutionDataDetails(included: IncludedDetails = com.amazonaws.sfn.includedDetails(false))
[error]                                                                                                     ^
[warn] 6 deprecations; re-run with -deprecation for details
[warn] one warning found
[error] target/scala-2.13/src_managed/main/smithy4s/com/amazonaws/sfn/HistoryEventExecutionDataDetails.scala:14:92: object truncated is not a member of package com.amazonaws.sfn
[error] did you mean Truncated?
[error] final case class HistoryEventExecutionDataDetails(truncated: Truncated = com.amazonaws.sfn.truncated(false))
[error]                                                                                            ^
[error] two errors found

Environment

IRasmivan commented 2 months ago

This error was not in "com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.0" version

kubukoz commented 2 months ago

This error was not in "com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.0" version

That's useful info, I'll do a bisect.

kubukoz commented 2 months ago

It's a regression from #1301.

Diff of 0.18.3 and 0.18.4:

14c14
< final case class CloudWatchEventsExecutionDataDetails(included: IncludedDetails = com.amazonaws.sfn.IncludedDetails(false))
---
> final case class CloudWatchEventsExecutionDataDetails(included: IncludedDetails = com.amazonaws.sfn.includedDetails(false))
24c24
<     IncludedDetails.schema.required[CloudWatchEventsExecutionDataDetails]("included", _.included).addHints(smithy.api.Documentation("<p>Indicates whether input or output was included in the response. Always <code>true</code>\n      for API calls. </p>"), smithy.api.Default(smithy4s.Document.fromBoolean(false))),
---
>     IncludedDetails.schema.field[CloudWatchEventsExecutionDataDetails]("included", _.included).addHints(smithy.api.Documentation("<p>Indicates whether input or output was included in the response. Always <code>true</code>\n      for API calls. </p>"), smithy.api.Default(smithy4s.Document.fromBoolean(false))),

so it's definitely default-related.

The datatype in smithy is named boolean includeDetails, so we're probably not capitalizing it by accident in TypedNode rendering. I'll prepare a more minimal reproduction.