使用graphql API时出现无效语法错误

使用graphql API时出现无效语法错误,graphql,graphql-java,express-graphql,graphql-subscriptions,Graphql,Graphql Java,Express Graphql,Graphql Subscriptions,在通过postman访问GraphQLAPI时,我也面临一些问题 http://testEnvrironment/restcall/getReports 柱体 getReports(id:15){ isApproved } } sample.graphqls文件的条目为 schema{ query: Query } type Query{ getReports(id: Long): PublishedReportInternal } type PublishedReportI

在通过postman访问GraphQLAPI时,我也面临一些问题

http://testEnvrironment/restcall/getReports
柱体

getReports(id:15){
    isApproved
}
}
sample.graphqls文件的条目为

schema{
    query: Query
}
type Query{
getReports(id: Long): PublishedReportInternal
}
type PublishedReportInternal{
sourceReport:ObjectRef
isApproved:Boolean
ignoreOutputFormatId:Boolean
}
type ObjectRef{
id : Long
qualifier : String
}
Rest端点将是

@POST
@Path(value = "/getReports") 
@Consumes
(value = MediaType.APPLICATION_JSON) 
@Produces
(value = MediaType.APPLICATION_JSON) ResponseEntity<Object> getReports( String query);
请尝试帮助我,因为我完全被这个问题困住了

以下罐子已被我用于此POC

compile files('libs/new/graphiql-spring-boot-starter-5.0.2.jar')
compile files('libs/new/graphql-java-9.2.jar')
compile files('libs/new/graphql-java-servlet-6.1.2.jar')
compile files('libs/new/graphql-java-tools-5.2.4.jar')
compile files('libs/new/graphql-spring-boot-autoconfigure-5.0.2.jar')
compile files('libs/new/graphql-spring-boot-starter-5.0.2.jar')
compile files('libs/new/java-dataloader-2.0.2.jar')    
compile files('libs/new/antlr4-runtime-4.7.1.jar')
compile files('libs/new/reactive-streams-1.0.3.jar')
上面的代码片段包含了我用来执行此POC的所有信息,但在执行此POC时,我始终遇到“无效语法”错误。请帮助解决此问题

问候
Kushagra

你们试过在操场上跑吗?您生成的架构应该如下所示:键入Query{getReports(id:Long):PublishedReportInternal},并且可以像Query Reports($id:Long){getReports(id:$id){isAccepted}}一样查询它,作为一个独立的spring启动应用程序,它正在工作。。。但当我试图将其与具有身份验证/授权逻辑+其他过滤器以及适当的DB和缓存调用的企业应用程序集成时,它会给我上述错误。看起来我显然错过了一些需要注意的事情。请帮助理解根本原因。尝试用查询{}{{{}{{{}}{{{{}}{{{{}}{{{{}}{{{}}{{{{}}}包装查询部分。我将尝试将“查询”放在{之前,并将更新您。同时,我尝试实现没有任何输入格式的简单查询类型:[output}{键入ReportOutputFormat{id:String name:String description:String defaultformat:Boolean}我正在使用下面的查询点击服务器查询{reportFormats{id name}}并尝试{reportFormats{id name}}同样,但结果仍然是一样的。我得到了同样的错误。这个问题的根本原因是什么。
@Service

public class GraphQLService {
@Value("classpath:sample.graphqls")
private Resource schemaResource;
private GraphQL graphQL;
@Inject
private CustomDataFetcher customDataFetcher;
@PostConstruct
private void loadSchema() throws IOException {
    // get the schema
    File schemaFile = schemaResource.getFile();
    System.out.println(schemaFile.getAbsolutePath());
    // parse schema
    TypeDefinitionRegistry typeRegistry = new SchemaParser().parse(schemaFile);
    RuntimeWiring wiring = buildRuntimeWiring();
    GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(typeRegistry, wiring);
    graphQL = GraphQL.newGraphQL(schema).build();
}
private RuntimeWiring buildRuntimeWiring() {
    return RuntimeWiring.newRuntimeWiring().type("Query", typeWiring -> typeWiring
            .dataFetcher("getReports", customDataFetcher)).build();
}
public GraphQL getGraphQL() {
    return graphQL;
}
}
@POST
@Path(value = "/getReports") 
@Consumes
(value = MediaType.APPLICATION_JSON) 
@Produces
(value = MediaType.APPLICATION_JSON) ResponseEntity<Object> getReports( String query);
compile files('libs/new/graphiql-spring-boot-starter-5.0.2.jar')
compile files('libs/new/graphql-java-9.2.jar')
compile files('libs/new/graphql-java-servlet-6.1.2.jar')
compile files('libs/new/graphql-java-tools-5.2.4.jar')
compile files('libs/new/graphql-spring-boot-autoconfigure-5.0.2.jar')
compile files('libs/new/graphql-spring-boot-starter-5.0.2.jar')
compile files('libs/new/java-dataloader-2.0.2.jar')    
compile files('libs/new/antlr4-runtime-4.7.1.jar')
compile files('libs/new/reactive-streams-1.0.3.jar')