sangria-graphql/sangria

Add deriveInterfaceType

Offen

#263 geöffnet am 08.07.2017

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Scala (219 Forks)batch import
derive-macrosfeaturehelp wanted

Repository-Metriken

Stars
 (1.961 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 8T 15h) (4 gemergte PRs in 30 T)

Beschreibung

Would be cool to have this for traits

trait MyInterface {
  def id: Int
  name: String
}
val MyInterfaceType = deriveInterfaceType[Unit, MyInterface]()

I think that another solution that is closer to deriveObjectType could be

case class MyInterfaceImpl(id: Int, name: String) extends MyInterface
val MyInterfaceType = deriveInterfaceType[Unit, MyInterfaceImpl](InterfaceTypeName("MyInterface"))

This would help because you don't have to copy & paste the field names into another definition

Contributor Guide