graphql模块通过嵌套扩展类型defs

graphql模块通过嵌套扩展类型defs,graphql,apollo,graphql-js,apollo-server,Graphql,Apollo,Graphql Js,Apollo Server,我正在使用阿波罗模块,我有多个模块: 用户档案, 学校, 项目 我有以下类型定义: UserProfile的类型定义: export const typeDefs = gql` extend type Query { getUserProfile(uuid: String!): UserProfile } type UserProfile { id: ID! email: String, uuid: String, firstName: St

我正在使用阿波罗模块,我有多个模块: 用户档案学校项目

我有以下类型定义:

UserProfile的类型定义:

export const typeDefs = gql`
  extend type Query {
    getUserProfile(uuid: String!): UserProfile
  }

  type UserProfile {
    id: ID!
    email: String,
    uuid: String,
    firstName: String,
    lastName: String,
    school: String
  }

  extend type Project {
    userInfo: UserProfile
  }
`;
为项目键入def:

export const typeDefs = gql`
  extend type Query {
    getProject(uuid: String!): Project
  }

  type Project {
    _id: ID!
    user: String,
    name: String,
    uuid: String
  }

  extend type UserProfile {
    userProjects: [Project]
  }
`;
以下是学校类型:

export const typeDefs = gql`
  extend type Query {
    getSchool(uuid: String!): School
  }

  type School {
    _id: ID!
    uuid: String,
    name: String,
  }

  extend type UserProfile {
    schoolInfo: School
  }
`;
现在,如果我执行以下查询:

query {
  getProject(uuid: "a9e2f2ea") {
    name
    uuid
    ownerInfo {
      email
      gender
    }
    userInfo {
      lastName
      school
      schoolInfo
    }
  }
}
它抱怨说它不能:

无法查询类型为“UserProfile”的字段“schoolInfo”


此架构缺少什么?

是否已导入所有模块

const server = new ApolloServer({
        modules: [
            require('./modules/userProfile'),
            require('./modules/project'),
            require('./modules/school'),
        ],
        context: ...
});
否则他们将无法互动