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
0
votes
0 answers

Is there any example on how to use spring security with graphql-spqr?

Looking for example on how to implement spring boot role based authentication and authorization for graphql-spqr project using spring security. Tried using spring-boot-starter-security but having issues while using playground. Getting below…
0
votes
0 answers

How to solve N+1 problem using leangen/graphql-spqr

Suppose I have below query method defined, Lets say getAllBooks returns 10 books, now if we query for price too, price method will be called multiple times (10 times in this case). How can I batch the call to price method. @GraphQLQuery(name =…
0
votes
1 answer

Dynamically restrict fields in graphql spring methods returning the same object type

Would it be possible to somehow restrict some fields from being returned in a graph ql method, bur return them in another considering they both return the same object ? For example in the following methods i would like to restrict the field…
0
votes
1 answer

Dynamic Query with GraphQL, SPQR, and Spring Boot: How to Optimize API Performance

I'm using GraphQL with SPQR and I would like to know if anyone knows how to create a dynamic query using Spring Boot and SPQR. I have the following query input: query findAllAlunosSerie { findAllAlunosSerie { id aluno { id …
Diego Macario
  • 1,240
  • 2
  • 21
  • 33
0
votes
1 answer

Generate API documentation using spring boot graphql spqr library

We are using Spring boot grphql sqpr library. We have to generate graphql API documentation which can be viewed in graphiql. For e.g. If i have field like below # comma separated location IDs. (eg: '5,12,27') locationIds: String then this…
gp185007
  • 51
  • 7
0
votes
0 answers

How to use @GraphQLInterface in SPQR

I want to return list of interfaces with different implementations by calling query/mutation in grpahql spqr. For this purpose I suppose I need to use @GraphQLInterface. Maybe I doing something wrong, but it not works. I have spring-boot app…
0
votes
1 answer

Graphql SPQR how to represent undefined fields

So I was reading this https://github.com/leangen/graphql-spqr/issues/197 and we have mutation createUser { createUser(name: "Test", address: null) { ... } } defined with this code @GraphQLMutation public User createUser(String name,…
Steve
  • 4,457
  • 12
  • 48
  • 89
0
votes
1 answer

GraphQL : Query failed to validate

I'm testing graph-spqr librabry in a simple java program. This is what I've done so far: public class GraphQLResolver { private String status; private Integer price; @GraphQLMutation(name="updateStatusOrder") public void…
blinkettaro
  • 341
  • 6
  • 18
0
votes
1 answer

How can I add properties to the mutation successful response

I am new to graphql-spqr so I hope this is an easy question, however I couldn't find a solution for this, even after a long search. Hint: In my app, I use the code-first/schema-last approach, which I like about the graphql-spqr, so there is no…
chriszichrisz
  • 527
  • 5
  • 11
0
votes
1 answer

How to treat a child class like its parent in GraphQL SPQR

I created a wrapper around BigDecimal. Basically just putting a bunch of friendlier methods on top of it. I use it for some of my POJO's fields, and it generates a schema like this # Built-in java.math.BigDecimal scalar BigDecimal input…
Steve
  • 4,457
  • 12
  • 48
  • 89
0
votes
1 answer

How to query GraphQL SPQR

I've read https://github.com/leangen/graphql-spqr-spring-boot-starter But I'm still a bit confused how to map what's in my code to what I need to query in my GraphQL request. @Named @GraphQLApi public class TradeService { @GraphQLQuery public…
Steve
  • 4,457
  • 12
  • 48
  • 89
0
votes
1 answer

"error": "Could not connect to websocket endpoint ws://localhost:8000/subscriptions. Please check if the endpoint url is correct." for graphql spqr

I have my data stored in mongodb and I'm trying to implemet subscription using graphql spqr and project reactive. I'm getting respones for when I'm trying to test mutations and query, but I keep on getting the following error message for…
0
votes
1 answer

GraphQL : How to write junit tests for graphql spqr and spring boot

I have implemented GraphQL endpoints with spring boot using the following lib - https://github.com/leangen/graphql-spqr. I currently have junits for REST endpoints using WebTestClient and have tried writing junits for spqr in a similar way but that…
Som
  • 91
  • 1
  • 10
0
votes
1 answer

graphiQL not showing GraphQL schmea (spring graphql-spqr)

I am using spring-boot with graphql-spqr. GraphQL queries and mutations work. But the GraphiQL webfrontend does not show the schema in the "documentatin explorer" in the rightmost column. Why? My graphql Controller @RestController public class…
Robert
  • 1,579
  • 1
  • 21
  • 36
0
votes
1 answer

GraphQL SPQR fetches all fields on the server side

I'm new to Spring Boot and I just started using graphql-spqr for Spring Boot since it allows for easy bootstrapping of Java projects. However, as per my understanding, GraphQL basically allows the fetching of selected fields from the database. As…
user782400
  • 1,617
  • 7
  • 30
  • 51