0
GraphQL 형식 내에서 필드를 분석하는 데 문제가 있습니다. 그래서, 나는 여기 patientQuery
GraphEx는 makeExecutableSchema로 매핑을 수정합니다.
const gqlSchema = makeExecutableSchema({
typeDefs: `
type patientQuery {
find: [String]
findOne: String
}
type Query {
patient: patientQuery
}
type Mutation {
addPost(name: String, title: String, content: String): patientQuery
}
schema {
query: Query
mutation: Mutation
}
`,
resolvers: {
patientQuery: {
find(root, params, context, ast) {
console.log('testing');
return ['title'];
}
}
}
});
의 find
속성을 해결하려고하지만이
{
patient {
find
}
}
같은 쿼리를 수행 할 때 난 항상
{
"data": {
"patient": null
}
}
는 그래서는 null를 얻을 patientQuery
유형의 필드를 해결하는 올바른 방법은 무엇입니까?
을, 나는 그것이 함께 할 수있다 생각한다 사실 문자열을 반환하지만 필드는 문자열 배열을 반환해야합니다. 'return [ 'title']' – XuoriG
배열을 반환하는 해결 함수를 변경했지만 여전히 null이 반환됩니다. – Shalkam