Questions tagged [spring-graphql]

Spring for GraphQL provides transport and an annotation model for exposing GraphQL APIs. It is supported with a dedicated Starter as of Spring Boot 2.7.0

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Support for multiple paths pointing to different graphql schema

I have two graphql schemas that we can say one as admin and one as internal and i need to map each with a separate graphql endpoint as:- Schema - admin.graphqls, internal.graphqls /graphql/admin and /...
KB Prodigy's user avatar
0 votes
0 answers
34 views

Reconfigure dataloaders when migrating from graphql-java-kickstart to spring-graphql

I'm in the process of migrating a GraphQl-java-kickstart project to Spring-GraphQl, as Spring-GraphQl was not available at the time when GraphQL was implemented in the project. The main reason for ...
Michiel's user avatar
  • 2,962
0 votes
1 answer
61 views

How to implement union in spring-graphql? I get error that I'm requesting object but its rather a 'graphql.schema.GraphQLUnionType'

I wanted to create a union named Tables, that holds all the other tables and the user can request the table accordingly. I get the error: You have asked for named object type 'Tables', but it's not an ...
SwimmingHigh's user avatar
1 vote
0 answers
32 views

Spring GraphQL - DataFetcher observations-missing keys

I am trying to monitor a Spring Boot GraphQL application using Spring Boot 3 Observability features. I managed to do well the monitoring for succesfull requests and now I am trying to collect some ...
Mars's user avatar
  • 117
0 votes
1 answer
32 views

Support for HTTP-Get extensions like persisted queries missing?

This is somewhere in between a feature a request and a possibly already answered question (which I haven't found, sorry in that case). I'm currently migrating from graphl-java-spring to spring-graphql ...
Wolfgang Schröder's user avatar
0 votes
1 answer
66 views

How can I intercept graphql queries?

I am using spring-boot-graphql-starter in my project. How can I add this interceptor to the graphql queries? This is how I configure the interceptor. However the context value is not filled in the ...
Mejmo's user avatar
  • 2,383
1 vote
1 answer
76 views

How to load GraphQL query file and call GraphQL API in Spring Boot

I have a spring boot microservice which uses Netflix DGS GraphQL framework which calls multiple backends/micro services. Most of the backend services are graphQL. For my orchestration I need to load ...
springbootlearner's user avatar
0 votes
0 answers
30 views

Spring graphql Connection in a custom mongo reactive repository that uses Aggregation

I am currently working on a sample project, and I am using the following stack Spring boot 3.1.4 spring-boot-starter-data-mongodb-reactive spring-boot-starter-graphql spring-boot-starter-webflux ...
Salvador Lopez's user avatar
0 votes
1 answer
74 views

Logback access events not capturing response content

We are developing a new service using Spring Boot and Spring for GraphQL. We want to enable logback access logs to capture both request and response headers and content. I have configured logback ...
Nodirbek Shamsiev's user avatar
0 votes
1 answer
49 views

Spring for GraphQL: addressing over- and under- fetching by changing schema structure?

I'm using Spring for GraphQL and having trouble understanding how to make my graphql resolvers avoid over- and under- fetching without modifying my schema to reflect how data is grouped in my database....
neets's user avatar
  • 7
0 votes
1 answer
43 views

Spring GraphQL - Validation error FieldsConflict returns different types 'Int' and 'String'"

I just start migrating from com.graphql to Spring with graphql but I'm struggling with an error when running my query, here's the error : "message": "Validation error (FieldsConflict@[...
Sou's user avatar
  • 1
0 votes
0 answers
50 views

How to retry a Spring WebSocketGraphQlClient query

Using Spring Boot 3.2.4 with Spring WebFlux/GraphQL subscription via Websocket. Server A exposes a graphqlSubscription, and Server B consumes the subscription. They both use the same components (...
loonis's user avatar
  • 1,317
0 votes
1 answer
86 views

Avoiding unnecessary database calls when converting JPA Entity to DTO in Spring Boot with GraphQL

I am developing an application using Spring Boot and GraphQL. When returning an Entity directly from GraphQL, data fetchers automatically handle the queries, fetching only the tables requested in the ...
Fatih Aksoy's user avatar
0 votes
1 answer
72 views

Graphiql not working due of security - Spring for GraphQL

I'm trying to use graphiql UI but due of Spring Security, I receive 401. What's the way to keep /graphql endpoint secured but let /graphiql request to graphql endpoint? I'm on Spring Boot 3.1.4 and ...
CharliePrm88's user avatar
0 votes
1 answer
110 views

Does Spring-graphl provide percentile metrics in spring-boot3?

When using spring-graphl with spring-boot 2, I can set the following properties: management.graphql.autotime.percentiles-histogram: true and I can get percentile histogram data metrics in prometheus ...
Wonger's user avatar
  • 307
0 votes
0 answers
23 views

Debugging missing observation in spring-graphql

What is the proper approach in determining the missing observations (graphql.request, graphql.datafetcher) by spring-graphql that is supported out-of-the-box (https://docs.spring.io/spring-graphql/...
princekc's user avatar
0 votes
0 answers
18 views

Junit test for suscription mapping not working

I have been referring to this https://docs.spring.io/spring-graphql/docs/current/reference/html/#testing to setup test for the subscriptionMapping However when I run the test the subscription start ...
Utkarsh Sharma's user avatar
0 votes
1 answer
149 views

GraphQL hide certain fields from a response

I am completely new to GraphQL - apologies if this is a stupid question. I have a Spring Boot application running GraphQL and have two endpoints as defined in my schema below: type Query { userById(...
Tom's user avatar
  • 227
0 votes
1 answer
146 views

SpringBoot3 SpringWeb and GraphQL throws No ContextAccessor for contextType: class reactor.util.context.Context

I am upgrading to SpringBoot3 (3.1.2). My app is a MVC with spring-boot-starter-web and spring-boot-starter-graphql on the path (Maven). When I call GraphQL (GraphiQL or Postman), I get an exception ...
user2824203's user avatar
0 votes
0 answers
28 views

spring webflux graphql test giving No qualifying bean of type AnnotatedControllerConfigurer

PFB my code. Getting below error when I run unit test case of below code. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework....
C P's user avatar
  • 1
0 votes
1 answer
79 views

UnsatisfiedDependencyException for org.springframework.graphql.test.tester.GraphQlTester

Getting below exception when I am executing the testcase given in below code for spring boot weblfux project using spring-graphql :- Please let me know what is the issue. This project is using spring ...
C P's user avatar
  • 1
0 votes
0 answers
103 views

Spring Boot Graphql: How can I pre-process an individual query/mutation before it runs the controller method?

I want to add an annotation to my controller methods that is used to check if the user can perform an action or access a piece of data before the controller method is called. I want to be able to ...
Mar's user avatar
  • 7,815
0 votes
0 answers
68 views

How to customize the Spring GraphQL Error Response

I am developing a project wherein I'm using GraphQL. The way GraphQL handles errors is not secure as it exposes the application logic and internals. Default GraphQL error response looks like this: { ...
Itachi's user avatar
  • 1
0 votes
0 answers
43 views

Spring GraphQl : access the parent argument in @SchemaMapping

I have below graphQL with year as an input to the query. type Query { getResult(year:Int):Parent } type Parent { child: Int } Can refer to the same argument in child? I tried with @Argument, ...
was_777's user avatar
  • 609
-1 votes
2 answers
202 views

GraphQL error : Method not allowed error for GraphQL requests with Spring 3.1.1

I have upgraded spring boot to 3.1.1 and I am getting 405 method not allowed for graphql call. I tried all the known options. pom.xml <groupId>org.springframework.boot</groupId>...
Abhishek's user avatar
0 votes
0 answers
69 views

Is there a Spring Data REST equivalent for GraphQL schemas?

Is there an equivalent to Spring Data REST for GraphQL? More specifically a library that automatically generates GraphQL schemas and query-, schema- and batch-mappings based on a noSQL schema in the ...
Ivan Janssens de Varebeke's user avatar
0 votes
1 answer
99 views

Why this mutation GraphQL query does not pass data through?

I have the Mutation below and I'd like to test it with the script below, but I don't know what is the problem with it. I already checked the documentation, at least 10 tutorials and according to those ...
AndrasCsanyi's user avatar
  • 3,963
0 votes
1 answer
144 views

clear spring for GraphQLContext content after request finished

I am using spring boot 3.1.1 to develop GraphQL application, also included spring-boot-starter-graphql, code as below, I want to delete all content from context after the request is done, how can I ...
george jiang's user avatar
0 votes
0 answers
155 views

Set up Apollo-Router with TLS

I'm having some issues by setting up apollo-router 1.9.0 to work with TLS. I tried to configure apollo-router using these configs: tls: subgraph: subgraphs: spring-graphql-service: ...
svx10's user avatar
  • 1
0 votes
1 answer
92 views

How to access all directives on selected fields of a query, with GraphQL Spring Boot?

I have an authentication directive, used to restrict fields to certain authentication levels directive @auth(role: [String!]!) on FIELD_DEFINITION For example, with the following schema type Query { ...
GeekOverdose's user avatar
1 vote
0 answers
187 views

Using GraphQL SelectionSet to limit the columns fetched when using Spring Data JPA and QueryDSL

As per Spring for GraphQL documentation, "By default the Querydsl and the Query by Example integrations turn the GraphQL selection set into property path hints that the underlying Spring Data ...
Arun Chandrasekaran's user avatar
0 votes
1 answer
223 views

Issues while adding Spring for GraphQL to an existing Spring 3 project

I am trying to implement Spring for GraphQL in a existing Spring Boot 3 project. I have followed the steps in the beginners guide, however when I try to run the application, I get several errors. Part ...
user avatar
0 votes
1 answer
54 views

Can't throw exception in the graphql @BatchMapping

I'm using Spring with graphql and have the following code: @QueryMapping public Client clientById(Long id) { return dao.findById(id).orElse(null); } @BatchMapping(typeName = "Client") ...
Stanislau Listratsenka's user avatar
0 votes
1 answer
266 views

Advice on extending DefaultServerRequestObservationConvention with request body data?

Currently, with Spring Boot, all http requests are instrumented through Micrometer (https://docs.spring.io/spring-framework/reference/integration/observability.html). However, for GraphQL requests, ...
princekc's user avatar
0 votes
0 answers
152 views

Scalar Type Json is not working when we are using type "Input" for Mutation

Scenario: When I have a scenario where I need to send one attribute with key value pair data to a graphql server, I use the Scalar type as Json in the setup and declare the same thing in the graphql ...
GRajaMca's user avatar
0 votes
1 answer
247 views

How to get the SecurityContext from within a DataFetcher (WebFlux + DGS GraphQL)

I am wondering if it is possible to obtain the Authentication from within the onField function contained in a SchemaDirectiveWiring. I've looked into using the ReactiveSecurityContextHolder and ...
Henry Hargreaves's user avatar
2 votes
0 answers
560 views

Asynchronous requests sometimes fail because the RequestFacade is recycled

I have the following view, which loads its data asynchronously: @Route(value = NewsAdminView.ROUTE) @RequiredArgsConstructor public class NewsAdminView extends VerticalLayout { public static final ...
Sebastian Lütge's user avatar
0 votes
1 answer
325 views

Does spring boot (Spring 3) graphql support tracing between microservices?

I'm using below micrometer dependencies along with spring boot graphql starter. <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-...
Sercan Ozdemir's user avatar
0 votes
0 answers
297 views

How to handle expired refresh tokens during GraphQL request

I have a Vaadin view that shows News entries: @RequiredArgsConstructor public class NewsView extends VerticalLayout private final NewsService service; protected void onAttach(final ...
Sebastian Lütge's user avatar
0 votes
0 answers
179 views

Custom Jackson object mapper for deserialization with the GraphQlClient

Is there any way I can provide a custom ObjectMapper to a Spring GraphQlClient to be used in deserialization of the response ? I have tried this, with no success HttpGraphQlClient.builder(client)....
Jan Olav Eide's user avatar
0 votes
1 answer
94 views

Accessing grandparent (source of source) in Spring for GraphQL @SchemaMapping

I can't find out how I can load a referenced resource, identified by a deeply nestet property in combination with a property higher up in a nested data structure. Given these classes (getters and ...
Claus Nielsen's user avatar
0 votes
2 answers
622 views

GraphQlTester is not autowired in test

Error: Cannot invoke "org.springframework.graphql.test.tester.GraphQlTester.document(String)" because "this.graphQlTester" is null Getting the above error. Have checked the jar ...
Shourya Sharma's user avatar
0 votes
0 answers
69 views

How to get BiFunction working for configureExecutionInput WebGraphQlInterceptor from spring-graphql documentation

I am trying to use following code snippet from the spring-graphql documentation class RequestHeaderInterceptor implements WebGraphQlInterceptor { @Override public Mono<WebGraphQlResponse&...
Pankaj Chouhan's user avatar
1 vote
0 answers
48 views

Can I add custom GraphQlWebSocketMessage as "start", When I try to executeSubscription?

I'm trying to executeSubscription using WebSocketGraphQlClient webSocketGraphQlClient.document("subscription onCommentsAdded { comment}") .executeSubscription(). ....
vedpathak supriya's user avatar
-1 votes
2 answers
195 views

Secure a Spring GraphQL API from traversal attacks

If I have a GraphQL API looking like this: type Query { userById (id: ID): User } type User { id: ID name: String secret: String supervisor: Supervisor } type Supervisor { id: ID name: ...
Patrik's user avatar
  • 116
3 votes
1 answer
1k views

Does WireMock support Mocking GraphQL APIs

We have multiple micro services which is based on GrapQL and few of them based on REST and each micro service will call multiple other microservices (Java, Spring Boot tech stack). Now we want to ...
springbootlearner's user avatar
2 votes
1 answer
428 views

Is there a way to add a second graphql endpoint in a spring-graphql project?

The background is that one endpoint is only intended for use within a data center and the other is intended to be publicly accessible. I read the documentation, but this topic is never mentioned.
Wilhelm's user avatar
  • 21
0 votes
0 answers
58 views

Spring batch application freezes abtruptly without log and error

I am facing strange issue with my application. I have Spring boot + batch application which is internally calling API to get some data and we are calling API using GraphQL. It is working fine 9/10 ...
Nikhil Srivastav's user avatar
0 votes
1 answer
464 views

How to implement a query with arguments for a custom type field

I want to implement pagination into custom type fields using arguments. Using a sample schema like this: type Book { title: String! year: Int! } type Author { name: String! books(page:...
t00manysecrets's user avatar
0 votes
0 answers
245 views

How to map nested object query in Spring graphql

Using org.springframework.boot:spring-boot-starter-graphql and WebMvc, I would like to handle, in the @Controller, nested fields. Schema: type Movie { name: String actor: Actor } type Actor { ...
SURAJ's user avatar
  • 103