我有一个这样定义的模型对象:
case class OrganizationId(value: Long) extends AnyVal with TypedId
case class OrganizationFields(name: String, iban: Option[String], bic: Option[String])
case class Organization(
id: OrganizationId, addressId: AddressId, updatedAt: LocalDateTime, insertedAt: LocalDateTime, fields: OrganizationFields
)
这是我在桑格利亚汽酒模式定义中尝试做的事情:
implicit val OrganizationFields = deriveObjectType[GraphqlContext, OrganizationFields]()
implicit val OrganizationType: ObjectType[GraphqlContext, Organization] = deriveObjectType[GraphqlContext, Organization]()
implicit val OrganizationInputType = deriveInputObjectType[OrganizationFields]()
我需要将其定义OrganizationFields
为ObjectType
能够Organization
在我的 graphql 查询中使用以及ObjectInputType
能够在我的 graphql 突变中使用它作为输入。问题是我在运行时遇到以下异常:
Type name 'OrganizationFields' is used for several conflicting GraphQL type kinds: ObjectType, InputObjectType. Conflict found in an argument 'organization' defined in field 'createOrganization' of 'Mutation' type
有没有办法让它工作?