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
102
questions
0
votes
0
answers
13
views
In graphql what is difference between a `type query` and `extend type query`?
In graphql what is difference between a type query and extend type query?
Ex: difference between
type Query {
product(id: String!): Product
}
and
extend type Query {
DeviceDetail(devId: ...
0
votes
0
answers
17
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 /...
0
votes
0
answers
35
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 ...
0
votes
1
answer
65
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 ...
1
vote
0
answers
35
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 ...
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 ...
0
votes
1
answer
70
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 ...
1
vote
1
answer
85
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 ...
0
votes
0
answers
32
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
...
0
votes
1
answer
75
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 ...
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....
0
votes
1
answer
47
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@[...
0
votes
0
answers
52
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 (...
0
votes
1
answer
87
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 ...
0
votes
1
answer
75
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 ...
0
votes
1
answer
117
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 ...
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/...
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 ...
0
votes
1
answer
157
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(...
0
votes
1
answer
161
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 ...
0
votes
0
answers
29
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....
0
votes
1
answer
81
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 ...
0
votes
0
answers
107
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 ...
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:
{
...
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, ...
0
votes
2
answers
211
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>...
0
votes
0
answers
70
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 ...
0
votes
1
answer
105
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 ...
0
votes
1
answer
145
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 ...
0
votes
0
answers
156
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:
...
0
votes
1
answer
93
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 {
...
1
vote
0
answers
188
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 ...
0
votes
1
answer
227
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 ...
0
votes
1
answer
55
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")
...
0
votes
1
answer
276
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, ...
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 ...
0
votes
1
answer
256
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 ...
2
votes
0
answers
578
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 ...
0
votes
1
answer
330
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-...
0
votes
0
answers
302
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 ...
0
votes
0
answers
181
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)....
0
votes
1
answer
95
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 ...
0
votes
2
answers
629
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 ...
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&...
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().
....
-1
votes
2
answers
200
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: ...
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 ...
2
votes
1
answer
431
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.
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 ...
0
votes
1
answer
466
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:...