Graphqls错误整理

最近公司接到了一个政府项目,需要使用graphql来完成前后端的交互,因为第一次使用踩了不少坑,目前也只是初步的使用,没有深入了解,先记录点遇到的常见bug,后续会继续添加。(后面应该不会添加了,楼主跳槽了)

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method ‘schemaParser’ threw exception; nested exception is com.coxautodev.graphql.tools.FieldResolverError: No method found with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order:stcsm.appropriation.controller.ExportControlle.findStcsmProjectsPage(~page, ~size, ~projectNumber, ~projectName, ~projectUnit, ~manageDepartmentCode, ~categoryCode, ~projectStateCode, ~arrangement)

在graphql中的findStcsmProjectsPage方法传递的参数缺失,检查后端接口与graphql文件对应的接口传递的参数是否一致

Caused by: com.coxautodev.graphql.tools.FieldResolverError: No method or field found with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order:stcsm.appropriation.utils.MyPage.starst()

stcsm.appropriation.utils.MyPage.getStarst()
stcsm.appropriation.utils.MyPage.starst
graphql中配置返回对象MyPage中的starst参数在实体类中不存在

stcsm-appropriation -2020-06-15 15:01:47.311 [http-nio-8082-exec-1] WARN graphql.GraphQL - [parseAndValidate,511] - Query failed to validate : 'query getProjectList($userId: String, $page: Int, $size: Int, $projectNumber: String, $projectName: String, $projectUnit: String, $manageDepartmentCode: String, $categoryCode: String, $projectStateCode: String, $arrangement: String) {findStcsmProjectsPage(userId: $userId, page: $page, size: $size, projectNumber: $projectNumber, projectName: $projectName, projectUnit: $projectUnit, manageDepartmentCode: $manageDepartmentCode, categoryCode: $categoryCode, projectStateCode: $projectStateCode, arrangement: $arrangement) { total projectMsg { id __typename } __typename }

前端请求时报错:检查graphql返回参数中的属性与前端需求的属性是否一致

你可能感兴趣的:(Graphqls错误整理)