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

bug: codegen generates incorrect types for sealed trait with lazy directive and abstractEffectType enabled #2492

Closed
i10416 opened this issue Dec 21, 2024 · 0 comments · Fixed by #2493
Labels
bug Something isn't working server Issue related to caliban server tools Issue related to Caliban tools like code generation or schema comparison

Comments

@i10416
Copy link
Contributor

i10416 commented Dec 21, 2024

directive @lazy on FIELD_DEFINITION

schema {
  query: Query
}

type Query {
    u: U
}


type A {
  field: Int @lazy
}

type B {
  field: Int
}

union U = A | B

import Types._

object Types {

  final case class A[F[_]](field: F[scala.Option[Int]]) extends U
  final case class B(field: scala.Option[Int]) extends U

  sealed trait U extends scala.Product with scala.Serializable

}

object Operations {

  final case class Query[F[_]](
      u: F[scala.Option[U[F]]]
                     // ^ Types.U does not take type parameters
  )

}

This is probably because SchemaWriter does not properly handle union that contains types with F[_] here.

def writeUnionSealedTrait(union: UnionTypeDefinition): String =

@i10416 i10416 changed the title codegen generates incorrect types for sealed trait with lazy directive and abstractEffectType enabled bug: codegen generates incorrect types for sealed trait with lazy directive and abstractEffectType enabled Dec 21, 2024
@ghostdogpr ghostdogpr added bug Something isn't working tools Issue related to Caliban tools like code generation or schema comparison server Issue related to caliban server labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Issue related to caliban server tools Issue related to Caliban tools like code generation or schema comparison
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants