Tre*_*xXx 0 scala graphql sangria
我有一个这样定义的模型对象:
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
)
Run Code Online (Sandbox Code Playgroud)
这是我在桑格利亚汽酒模式定义中尝试做的事情:
implicit val OrganizationFields = deriveObjectType[GraphqlContext, OrganizationFields]()
implicit val OrganizationType: ObjectType[GraphqlContext, Organization] = deriveObjectType[GraphqlContext, Organization]()
implicit val OrganizationInputType = deriveInputObjectType[OrganizationFields]()
Run Code Online (Sandbox Code Playgroud)
我需要将OrganizationFields
两者定义为ObjectType
能够Organization
在我的 graphql 查询中使用的 an 以及ObjectInputType
能够在我的 graphql 突变中使用它作为输入的 an 。问题是我在运行时遇到以下异常:
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
有办法让它工作吗?
In your example, both GraphQL types would have the same name. This is not allowed since all types within a GraphQL schema share the same global namespace.
You can rename one of these types in order to solve this issue. For example:
implicit val OrganizationInputType = deriveInputObjectType[OrganizationFields](
InputObjectTypeName("OrganizationFieldsInput"))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1133 次 |
最近记录: |