Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen fails with The httpPrefixHeaders trait is not supported #1505

Open
kkrs opened this issue Apr 26, 2024 · 0 comments
Open

codegen fails with The httpPrefixHeaders trait is not supported #1505

kkrs opened this issue Apr 26, 2024 · 0 comments
Labels
AWS support Issues related to AWS support

Comments

@kkrs
Copy link

kkrs commented Apr 26, 2024

I run into this error when running smithy4sCodeGen

> mill pb.smithy4sCodegen                                                                                                                                          [? M][git:scalazzi/smithy4s-aws]
[37/37] pb.smithy4sCodegen 
1 targets failed
pb.smithy4sCodegen software.amazon.smithy.openapi.OpenApiException: The `httpPrefixHeaders` trait is not supported by OpenAPI and was found on `com.amazonaws.s3#CreateMultipartUploadRequest$Metadata`
    software.amazon.smithy.openapi.fromsmithy.mappers.CheckForPrefixHeaders.check(CheckForPrefixHeaders.java:78)
    software.amazon.smithy.openapi.fromsmithy.mappers.CheckForPrefixHeaders.lambda$before$1(CheckForPrefixHeaders.java:55)
    java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715)
    java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    software.amazon.smithy.openapi.fromsmithy.mappers.CheckForPrefixHeaders.before(CheckForPrefixHeaders.java:54)
    software.amazon.smithy.openapi.fromsmithy.OpenApiMapper$1.before(OpenApiMapper.java:416)
    software.amazon.smithy.openapi.fromsmithy.OpenApiConverter.convertWithEnvironment(OpenApiConverter.java:316)
    software.amazon.smithy.openapi.fromsmithy.OpenApiConverter.convertToNode(OpenApiConverter.java:165)
    alloy.openapi.package$.$anonfun$convertWithConfig$6(package.scala:85)
    scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
    scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
    scala.collection.immutable.Set$Set1.map(Set.scala:165)
    alloy.openapi.package$.$anonfun$convertWithConfig$4(package.scala:78)
    scala.collection.immutable.List.flatMap(List.scala:293)
    alloy.openapi.package$.convertWithConfig(package.scala:75)
    alloy.openapi.package$.convert(package.scala:115)
    smithy4s.codegen.internals.CodegenImpl$.generate(CodegenImpl.scala:67)
    smithy4s.codegen.Codegen$.generate(Codegen.scala:22)
    smithy4s.codegen.Codegen$.generateToDisk(Codegen.scala:25)
    smithy4s.codegen.mill.Smithy4sModule.$anonfun$smithy4sCodegen$3(Smithy4sModule.scala:224)

smithy-build.json looks like this (I've also tried multiple prefixes of "service": "com.amazonaws.s3#CreateMultipartUploadRequest)

{
    "version": "1.0",
    "maven": {
        "dependencies": [
            "com.disneystreaming.alloy:alloy-core:0.3.7"
        ]
    },
    "plugins": {
        "openapi": {
            "service": "com.amazonaws.s3#CreateMultipartUploadRequest$Metadata",
            "onHttpPrefixHeaders": "WARN",
            "ignoreUnsupportedTraits": true
        }
    }
}

Also my build configuration has this

object pb extends SbtModule with Smithy4sModule with CommonModule {
  import java.nio.file.{Paths, Path}

  def scalaVersion = scala3Version
  // override def smithy4sVersion = "0.18.16"

  override def ivyDeps =
    super.ivyDeps() ++ Agg(
      ivy"com.disneystreaming.smithy4s::smithy4s-core:${smithy4sVersion()}",
      ivy"com.disneystreaming.smithy4s::smithy4s-http4s-swagger:${smithy4sVersion()}",
      ivy"com.disneystreaming.smithy4s::smithy4s-aws-http4s:${smithy4sVersion()}",
      //ivy"com.disneystreaming.smithy:aws-s3-spec:2023.23.30",
      //ivy"com.disneystreaming.smithy:aws-ec2-spec:2023.23.30",
      //ivy"com.disneystreaming.smithy:aws-dynamodb-spec:2023.23.30",
      ivy"org.http4s::http4s-ember-server:$http4sVersion",
      ivy"org.http4s::http4s-ember-client:$http4sVersion"
    )

  override def smithy4sAwsSpecs: T[Seq[String]] = T(Seq(
    AWS.dynamodb,
    AWS.s3,
    AWS.ec2,
  ))
  
  ...
}
@kkrs kkrs changed the title The httpPrefixHeaders trait is not supported by OpenAPI and was found on com.amazonaws.s3#CreateMultipartUploadRequest$Metadata smithy4sCodeGen causes The httpPrefixHeaders trait is not supported .... on com.amazonaws.s3#CreateMultipartUploadRequest$Metadata May 7, 2024
@kkrs kkrs changed the title smithy4sCodeGen causes The httpPrefixHeaders trait is not supported .... on com.amazonaws.s3#CreateMultipartUploadRequest$Metadata codegen fails with The httpPrefixHeaders trait is not supported May 7, 2024
@kubukoz kubukoz added the AWS support Issues related to AWS support label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS support Issues related to AWS support
Projects
None yet
Development

No branches or pull requests

2 participants