Questions tagged [graphql-spqr]

GraphQL SPQR is a graphql-java based library for rapid development of GraphQL servers in Java, using the code-first approach. A question tagged with graphql-spqr should be related to GraphQL SPQR, either inquiring about its usage or features, or referring to its functionality directly in the supplied code.

GraphQL SPQR is a simple-to-use library for rapid development of GraphQL APIs in Java. It takes the code-first approach to GraphQL development, where the server-side code is written first and the GraphQL schema is generated from it.

GraphQL SPQR Spring Boot Starter uses the base GraphQL SPQR library to automatically expose the chosen Spring beans, configure a web end-point and optionally set up a subscription server.

83 questions
2
votes
1 answer

JWT Authentication graphql-spqr with spring security

I am using graphql-spqr-spring-boot-starter, version 0.0.5 in my spring boot application. @GraphQLApi & @GraphQLQuery working fine and I am fetching data on /gui as well. But as many have faced I am trying to apply the authentication part on graphql…
2
votes
1 answer

How to get a schema file in graphql using spqr-spring-boot-starter?

Could anyone please help me how to get a schema file using spqr-spring-boot-starter? I looked for the solutions online and found this: How to get the generated scheme file .graphqls using SPQR? new SchemaPrinter( // Tweak the…
2
votes
1 answer

Unable to get rid of 'Exception while fetching data(/{apiName})' in graphql-spqr-spring-boot-starter

I’m using ‘graphql-spqr-spring-boot-starter’ library version 0.0.4 of ‘io.leangen.graphql’. I'm able to customize errors. See the below code and screenshot for reference: Models: @Getter @Setter @ToString @Entity @Accessors public class Student { …
2
votes
1 answer

Is there a way to read request headers in @GraphqQuery method

I need to read data from request header in my graphql query resolver. Using graphql-spqr library . method sample. import io.leangen.graphql.annotations.*; import io.leangen.graphql.spqr.spring.annotation.GraphQLApi; import…
dchhatani
  • 31
  • 5
2
votes
0 answers

Is it possible to create namespaces or logical groups to group queries/mutations in GraphQL?

I am using io.leangen.graphql.spqr library version 0.10.1 which is the latest version at the moment. Is it possible to make logical groups to separate queries? For example, I have the list of queries: borrowBook, lendBook bookInfo, books chooseBook,…
Dmytro Chasovskyi
  • 3,209
  • 4
  • 40
  • 82
2
votes
2 answers

Generated fields aren't matching what I have defined in my entity

I am creating a Kotlin Spring-Boot api with a GraphQL interface. I am facing an issue when accessing one of my entities through GraphQL. Below you can most of my setup for accessing the user object. The issue is coming from the generated fields in…
dtptw6
  • 53
  • 8
2
votes
2 answers

graphql-spqr can not query the parent class field

I tried to implement entity classes using polymorphism. This is my BaseEntity @Getter @Setter @Accessors(chain = true) @MappedSuperclass @NoArgsConstructor @AllArgsConstructor @EntityListeners(AuditingEntityListener.class) public class BaseEntity…
EchoCow
  • 163
  • 8
1
vote
1 answer

How to handle identity fields in GraphQL SPQR

Let's say I have @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="trade_id") int tradeId; When I query this from the database, I will want to get the tradeId. However, when performing a Create, obviously I won't have the…
Steve
  • 4,457
  • 12
  • 48
  • 89
1
vote
0 answers

What is the use of ResolutionEnvironment?

I am trying to refactor ResolutionEnvironment out so I can use that service call with @cacheable with hazelcast I have tried reading the…
EdNight
  • 21
  • 2
1
vote
1 answer

GraphQL Federation: How To Consume, Not Extend

I have a service that returns Products that I can extend via GraphQL Federation in a service returning Reviews. The review service depends on the Products and this decoupling is just awesome! I also have an order service that stores (among other…
rü-
  • 2,129
  • 17
  • 37
1
vote
1 answer

graphql-spqr: How to add a GraphQL property to an entity

I have a basic Java entity class. public class Result { String resultTitle; String resultDecription; } This class is returned in a GraphQL query @GraphQLQuery(name = "getResult") public Result getResult() { Result result = //get result, e.g.…
Robert
  • 1,579
  • 1
  • 21
  • 36
1
vote
1 answer

graphql-java SPQR: how to use @GraphQLUnion annotation?

I inherited a project using GraphQL in Java with Grapqhl-SPQR spring boot starter package (v 0.0.3). It uses annotations to autogenerate the GraphQL SDL, but I need to improve error handling. From what I have found online, I need to implement a…
Sam
  • 571
  • 1
  • 6
  • 18
1
vote
0 answers

Hibernate & Spring Boot with GraphQL - Only Load Selected Values

I'm currently using GraphQL SPQR with Spring Boot. In order to improve database performance I have written custom logic using the @GraphQLEnvironment ResolutionEnvironment from this I have been able to find all the requested values and filter them…
jameslfc19
  • 1,084
  • 1
  • 10
  • 14
1
vote
3 answers

how to Disable Schema Introspection in graphql-spqr-spring-boot-starter

I have integrated my spring boot application with graphql-spqr-spring-boot-starter https://github.com/leangen/graphql-spqr-spring-boot-starter , I need to find a way on how to disable graphql schema introspection since its a security issue for…
1
vote
0 answers

How to create a mutation with respect to the current user in GraphQL?

I am trying to create a mutation method for adding movies to a users favorite list, but am unsure how to structure the mutation to include a specified user. I have a query to view all favorites a user might have which looks like this. query…