源码分析
源码
- 验证 Schema 的有效性
- 解析 Source(Operation)
- 执行
- validateSchema
- validateRootTypes
- validateDirectives
- validateTypes
- parseSource
- Source
- Document
- execute
- rootType -> 可以从此获取到诸多 fields
执行 execute
- execute
- buildExecutionContext: 构建执行上下文信息,如 defaultResolver、operation 等
- rootFields: 通过 获取到根路径的所有字段
- executeOperation
Query
executeFields(exeContext, rootType, rootValue, path, rootFields);
- executeFields
- executeField
- source, args, contextValue, info
- resolvFn
- completeValue
- executeField
Mutation
executeFieldsSerially(exeContext, rootType, rootValue, path, rootFields);
- executeFieldsSerially
Schema
-
GraphQLSchema
-
GraphQLObjectType
-
GraphQLDirective
-
isObjectType
-
schema.getQueryType()
-
schema.getMutationType()
-
schema.getSubscriptionType()
-
schema.getDirectives()