如何解决如何使用 GraphQL 在嵌套对象上创建突变模式?
我正在尝试创建一个 graphql 突变以使用其他对象的数组更新对象字段。这是我的架构:
"url":
post:
summary: Saves user properties
operationId: saveProperties
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: request
description: request
required: true
schema:
"$ref": "#/deFinitions/SavePropertiesDto"
originalRef: SavePropertiesDto
SavePropertiesDto:
type: object
required:
- saveProperties
properties:
saveProperties:
type: array
items:
"$ref": "#/deFinitions/SavePropertyDto"
originalRef: SavePropertyDto
SavePropertyDto:
type: object
required:
- agree
- Id
properties:
agree:
type: boolean
Id:
type: string
title: SavePropertyDto
mutation someFunc($requestBody: [SavePropertyInput!]) {
saveProperties(requestBody: $requestBody) {
agree
Id
}
我收到错误
Field \"saveProperties\" must not have a selection since type \"JSON\" has no subfields
当我执行此请求时。此外,我不等待对此查询的响应,而只等待 204 代码。据我了解,我需要将 SavePropertyInput 作为变量传递给查询请求。抱歉,我使用 yml 格式的数据。提前致谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。