GraphQL에서 작업을 시작했습니다. 내 스키마에도 하나의 목록 항목이 포함되어 있습니다. 다음배열을 GraphQL에서 인수로 전달
는내 스키마의 코드입니다 :
var userType = new graphql.GraphQLObjectType({
name: 'user',
fields: function() {
return {
_id: {
type: graphql.GraphQLID
},
name: {
type: graphql.GraphQLString
},
age: {
type: graphql.GraphQLString
},
degrees:[
{type:graphql.GraphQLList}
]
}
}
});
다음과 같이 쿼리는 다음과 같습니다
var QueryType = new graphql.GraphQLObjectType({
name: 'Query',
fields:() => ({
userArr: {
type: new graphql.GraphQLList(userType),
args:{
degrees:{type:new graphql.GraphQLList(userType)}
},
resolve: function(source, args) {
console.log(args);
resolve(args);
}
}
})
})
기본적으로 나는 클라이언트의 graphql 쿼리에서 배열을 게시해야하고 그에 따라 쿼리를 정의해야한다. 이 문제에 대한 도움을 찾을 수 없기 때문에 제안이 있습니다 ..
를 정의해야 위의 제안을 사용할 수 있습니다. ** user.degrees 필드 유형은 출력 유형이어야하지만 정의되지 않음 ** –
userType의 코드가 올바른지 확인하십시오. –
Gotcha, userType을 게시 할 수 있습니까? 원래 게시물을 편집하고 github gist code snippit을 게시하면 – Justin