Questions tagged [graphql-java]

graphql-java is a Java implementation for GraphQL, a query language created by Facebook for describing data requirements on complex application data models.

Useful links

Java Implementations:

596 questions
10
votes
2 answers

Dynamic generate GraphQL schema supports

Is it possible to dynamically create a GraphQL schema ? We store the data in mongoDB and there is a possibility of new fields getting added. We do not want any code change to happen for this newly added field in the mongoDB document. Is there any…
JasonS
  • 445
  • 1
  • 5
  • 17
9
votes
2 answers

GraphQL java send custom error in json format

I am working in an graphql application where I have to send custom error object / message in json irrespective of whether it occurs in servlet or service. Expected error response { errorCode: 400 //error goes here, errorMessage: "my error mesage"}…
mperle
  • 3,342
  • 8
  • 20
  • 34
9
votes
1 answer

Validation error of type FieldUndefined: Field 'register' in type 'Query' is undefined

I am new to GrapQL. I am trying to use it with spring boot. I can make query successfully, it is returning the data that I need, but i want now to use mutation. I need to add a use to database when he registers. This is my schema.graphqls file: type…
P3P5
  • 923
  • 6
  • 15
  • 30
8
votes
2 answers

getting requested fields on resolver level from graphql

Model of book from graphql schema type Book { id: ID name: String pageCount: Int author: Author } So I am having this resolver for Book public class BookResolver implements BookByIdQueryResolver, GraphQLQueryResolver { private final…
doubleW
  • 590
  • 5
  • 17
8
votes
0 answers

Mock ApolloClient's query(call) for testing purposes

Kotlin Android app using graphQl & ApolloClient. I want to test this method: fun myMethod(id: String): Single> { val call = Query(id) return Rx2Apollo.from(apolloClient.query(call)) .map { modeCode()…
Alejandra
  • 576
  • 6
  • 10
8
votes
1 answer

GraphQL api consuming with spring boot Resttemplate resulting in {"errors":[{"message":"No query string was present"}]} always

Currently we want to consume a graphQL endpoint in a springboot application using resttemplate However, when we make a POST request with the below query we are always receiving the same error {"errors":[{"message":"No query string was…
krishna110293
  • 127
  • 1
  • 1
  • 7
8
votes
1 answer

Making Graphql input where input can take different types

I want to create mutation apis where input can be of different types, something like interface which we have in types. I know that we cannot have interface in input types, I want to know how we can support multiple input types in just one input. To…
Deepak Patankar
  • 3,076
  • 3
  • 16
  • 35
8
votes
1 answer

How to group by Graphql query result

I have a following GraphQL query query { Result: querydata { name code description } } that returns me the following data { "data": { "Result": [ { "name": "Class1", "code": "ST1", "description":…
Learning Curve
  • 1,449
  • 7
  • 30
  • 60
8
votes
0 answers

GraphQL custom scalar (LocalDateTime) not working with JSON input in Java

In our GraphQL SpringBoot application we are successfully using custom scalar implementation for LocalDateTime via graphql-java-datetime com.zhokhov.graphql
Master
  • 81
  • 1
  • 4
8
votes
2 answers

spring boot starter graphql not working

I recently started working with graphql and found it very intriguing. Since most of my rest apps were in java, I decided to do a quick setup using the provided spring boot starter project by the graphql-java team. It comes with graph-iql autoconf…
faizanjehangir
  • 2,771
  • 6
  • 45
  • 83
7
votes
0 answers

getContext alternative for graphql.schema.DataFetchingEnvironment

I'm using the graphql-java-kickstart library in Spring Boot and have some code like so: class MyResolver implements GraphQLQueryResolver { public String helloWorld(DataFetchingEnvironment env) { // this works!! …
7
votes
1 answer

Representing calculations/script functions in GraphQL queries and schema

We are using GraphQL as a query language for a data aggregation engine. I am looking for ideas to represent simple (or complex) arithmetic calculation functions in GraphQL referring to existing types/attributes defined in a schema, and can be used…
am00100
  • 71
  • 1
  • 4
7
votes
1 answer

Does GraphQL take Int as enum

I was trying to create an enum type with Int value in GraphQL schema but failed. I might miss something in the doc. Anyone has any idea about how to implement Int value in the enum type like below? enum IntValue { 1 2 3 }
ZSFS
  • 81
  • 1
  • 5
7
votes
1 answer

How to raise multiple validation errors in graphql-spring-boot when using resolvers?

I am using the graphql-spring-boot library, and using the resolver objects to resolve the value of the input query. Here's an example: @Component public class BookResolver implements GraphQLQueryResolver { @Autowired private BookImpl…
Louise
  • 71
  • 1
  • 4
7
votes
3 answers

ValidationError FieldUndefined SPQR GraphQL

I am getting the following and cant seem to find an answer. Error [ValidationError{validationErrorType=FieldUndefined, queryPath=[find_by_id], message=Validation error of type FieldUndefined: Field 'find_by_id' in type 'Query' is undefined @…
Tinus Jackson
  • 3,397
  • 2
  • 25
  • 58
1
2
3
39 40