sangria-graphql/sangria

Add deriveInterfaceType

Aperta

#263 aperta il 8 lug 2017

 (2 commenti) (0 reazioni) (0 assegnatari)Scala (219 fork)batch import
derive-macrosfeaturehelp wanted

Metriche repository

Star
 (1961 stelle)
Metriche merge PR
 (Merge medio 8g 15h) (4 PR mergiate in 30 g)

Descrizione

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

Guida contributor