sangria-graphql/sangria

Add deriveInterfaceType

开放

#263 创建于 2017年7月8日

 (2 条评论) (0 个反应) (0 位负责人)Scala (219 个派生)batch import
derive-macrosfeaturehelp wanted

仓库指标

星标
 (1,961 个星标)
PR 合并指标
 (平均合并 8天 15小时) (30 天内合并 4 个 PR)

描述

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

贡献者指南