【发布时间】:2022-12-17 07:52:36
【问题描述】:
这里使用了内联片段 graphql。我无法在 js 文件中写入返回类型。
图形数据库:
query MyQuery {
samples(dataset: "", view: "") {
edges {
node {
... on ImageSample {
id
}
... on PointCloudSample {
id
}
}
}
}
}
JS 文件:这会引发语法错误:
const SAMPLE_DATA = {
edges: {
node: {
... on ImageSample {
id
sample
}
... on PointCloudSample {
id
}
}
}
};
我也试过 node: {id} 但没有帮助
无法查询类型“SampleItem”上的字段“id”。您是想在“Sample”、“ImageSample”、“PointCloudSample”或“VideoSample”上使用内联片段吗?
像这样调用 GraphQL 查询:
const gqlQuery = jsonToGraphQLQuery({ query: { samples: { __args: { ...data, }, ...SAMPLE_DATA } } }, { pretty: true });谁能帮我写
SAMPLE_DATA响应类型?
【问题讨论】: