disneystreaming / smithy4s

https://disneystreaming.github.io/smithy4s/
Other
349 stars 71 forks source link

AWS: Health API doesn't compile #1533

Open kubukoz opened 5 months ago

kubukoz commented 5 months ago

Version: 0.18.19

Build:

val root = project
  .in(file("."))
  .settings(
    scalaVersion := "3.4.2",
    libraryDependencies ++= Seq(
      "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value,
      "org.http4s" %% "http4s-ember-server" % "0.23.27",
      "org.http4s" %% "http4s-ember-client" % "0.23.27",
    ),
    fork := true,
    smithy4sAwsSpecs += AWS.health,
  )
  .enablePlugins(Smithy4sCodegenPlugin)

Error:

[info] compiling 117 Scala sources to /Users/kubukoz/projects/smithy4s-course/ep9/target/scala-3.4.2/classes ...
[error] -- [E008] Not Found Error: /Users/kubukoz/projects/smithy4s-course/ep9/target/scala-3.4.2/src_managed/main/scala/smithy4s/com/amazonaws/health/AccountEntityAggregate.scala:17:76 
[error] 17 |final case class AccountEntityAggregate(count: Count = com.amazonaws.health.count(0), accountId: Option[EventArn] = None, statuses: Option[Map[EntityStatusCode, Count]] = None)
[error]    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |value count is not a member of com.amazonaws.health - did you mean health.Count?
...
[error] -- [E007] Type Mismatch Error: /Users/kubukoz/projects/smithy4s-course/ep9/target/scala-3.4.2/src_managed/main/scala/smithy4s/com/amazonaws/health/EntityStatusCode.scala:32:66 
[error] 32 |  final case class $Unknown(str: String) extends EntityStatusCode(str, "$Unknown", -1, Hints.empty)
[error]    |                                                                  ^^^
[error]    |Found:    ($Unknown.this.str : com.amazonaws.health.String)
[error]    |Required: String²
[error]    |
[error]    |where:    String  is a type in package object health which is an alias of com.amazonaws.health.String.Type
[error]    |          String² is a class in package java.lang
[error]    |
[error]    | longer explanation available when compiling with `-explain`
...
[error] 14 errors found

(these two happen a couple times each, it's always Count and String)

takapi327 commented 1 month ago

version: 0.18.24

sns does not seem to compile in the same way.

Build:

val root = project
  .in(file("."))
  .settings(
    scalaVersion := "3.5.0",
    libraryDependencies ++= Seq(
      "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value,
      "org.http4s" %% "http4s-ember-client" % "0.23.27",
    ),
    fork := true,
    smithy4sAwsSpecs += AWS.sns,
  )
  .enablePlugins(Smithy4sCodegenPlugin)

Error:

[info] compiling 171 Scala sources to /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/classes ...
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/BatchResultErrorEntry.scala:20:106
[error] 20 |final case class BatchResultErrorEntry(id: String, code: String, senderFault: Boolean = com.amazonaws.sns.boolean(false), message: Option[String] = None)
[error]    |                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/CheckIfPhoneNumberIsOptedOutResponse.scala:25:94
[error] 25 |final case class CheckIfPhoneNumberIsOptedOutResponse(isOptedOut: Boolean = com.amazonaws.sns.boolean(false))
[error]    |                                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/GetSMSSandboxAccountStatusResult.scala:12:91
[error] 12 |final case class GetSMSSandboxAccountStatusResult(isInSandbox: Boolean = com.amazonaws.sns.boolean(false))
[error]    |                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/SNS.scala:1406:107
[error] 1406 |  def subscribe(topicArn: TopicARN, protocol: Protocol, returnSubscriptionArn: Boolean = com.amazonaws.sns.boolean(false), endpoint: Option[Endpoint2] = None, attributes: Option[Map[AttributeName, AttributeValue]] = None): F[SubscribeInput, SNSOperation.SubscribeError, SubscribeResponse, Nothing, Nothing]
[error]      |                                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/SNS.scala:1691:109
[error] 1691 |    def subscribe(topicArn: TopicARN, protocol: Protocol, returnSubscriptionArn: Boolean = com.amazonaws.sns.boolean(false), endpoint: Option[Endpoint2] = None, attributes: Option[Map[AttributeName, AttributeValue]] = None): Subscribe = Subscribe(SubscribeInput(topicArn, protocol, returnSubscriptionArn, endpoint, attributes))
[error]      |                                                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/SNS.scala:1735:109
[error] 1735 |    def subscribe(topicArn: TopicARN, protocol: Protocol, returnSubscriptionArn: Boolean = com.amazonaws.sns.boolean(false), endpoint: Option[Endpoint2] = None, attributes: Option[Map[AttributeName, AttributeValue]] = None): P1[SubscribeInput, SNSOperation.SubscribeError, SubscribeResponse, Nothing, Nothing] = f[SubscribeInput, SNSOperation.SubscribeError, SubscribeResponse, Nothing, Nothing](alg.subscribe(topicArn, protocol, returnSubscriptionArn, endpoint, attributes))
[error]      |                                                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] -- [E008] Not Found Error: /Users/takahiko.tominaga/Development/smithy4s-sandbox/target/scala-3.5.0/src_managed/main/smithy4s/com/amazonaws/sns/SubscribeInput.scala:177:123
[error] 177 |final case class SubscribeInput(topicArn: TopicARN, protocol: Protocol, returnSubscriptionArn: Boolean = com.amazonaws.sns.boolean(false), endpoint: Option[Endpoint2] = None, attributes: Option[Map[AttributeName, AttributeValue]] = None)
[error]     |                                                                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |value boolean is not a member of com.amazonaws.sns - did you mean sns.Boolean?
[error] 7 errors found
[error] (Compile / compileIncremental) Compilation failed
kubukoz commented 1 month ago

Half of my issue, and your entire issue @takapi327, should be fixed by #1593.

The other half is the mismatch of String and com.amazonaws.health.String.

takapi327 commented 1 month ago

@kubukoz Thank you! I tried it in my local environment using the modified branch and it compiled fine.