ghostdogpr / caliban

Functional GraphQL library for Scala

Home Page:https://ghostdogpr.github.io/caliban/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codegen: Incorrect order of description in server sealed trait generation

queirosa opened this issue · comments

I noticed a codegen problem when the result is a sealed trait:

"""TypeNameDescription"""
interface TypeName {
  """fooDescription"""
  foo: AType!
}
@GQLInterface
@GQLDescription("traitDescription")
sealed trait TypeName extends scala.Product with scala.Serializable  {
         def @GQLDescription("description") foo : AType
}

And

def @GQLDescription("description") foo : AType

Isn't valid scala and should be :

@GQLDescription("description") def status : AType

I suspect the problem comes from :

${interface.fields.map(field => "def " + writeField(field, interface)).mkString("\n")}

I can solve this but I'm afraid I don't know what is the correct way relatively to the rest of the codebase.

Woops, opened a PR to fix it