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
10
votes
1 answer

How to create compile-time constant in Kotlin from enum?

I have an annotation that requires defaultValue to be compile-time constant. I take defaultValue from enum below: enum class RaceType { MARATHON, SPRINT; companion object { fun apply(type: RaceType): RaceDto { return…
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
5
votes
2 answers

How to get the generated scheme file .graphqls using SPQR?

I really like the way SPQR makes easy to integrate graphql with an existing system, the only thing I'd like to see is the .graphqls file so I can learn more on GraphQL Syntax. Is there a way to generate the scheme file from an existing code with…
Ruslan López
  • 4,433
  • 2
  • 26
  • 37
4
votes
0 answers

How to stop graphql-spqr-spring-boot-starter from printing logs in case of exception?

Could someone please help me on how to avoid printing stack trace in graphql in case exception happens (e.g. sending invalid id to find a record or creating a record without sending a mandatory field)? I'm using graphql-spqr-spring-boot-starter and…
4
votes
0 answers

How to access field level Graphql directive with graphql-spqr

Given a graphql Query query @my (arg:1) { foo @my (arg:2) { bar @my (arg:3) foobar @my (arg:4) } } And graphql server implementation using graphql-spqr @GraphQLType(name="foo") public class Foo{ @GraphQLQuery(name="bar") public…
Dennis C
  • 24,511
  • 12
  • 71
  • 99
4
votes
1 answer

GraphQL SPQR - How to get the list of the fields were requested by client using a query

is there a way to retrieve the list of the fields were requested in a GraphQL query by a client? Lets assume I have the following types: type Book { isbn: String title: String genre: String author: Author } type Author { …
Massimo Da Ros
  • 393
  • 3
  • 11
4
votes
1 answer

Why does graphql java query all fields in entity when I only ask for a few?

I created a basic graphql-java app with the spring boot starter and using the graphql spqr library against an MSSQL database utilizing Hibernate and Jpa. I have an entity called "Task" with 5 fields. I have a simple Jpa repository and a simple Jpa…
J-man
  • 1,743
  • 3
  • 26
  • 50
4
votes
1 answer

How to implement Subscriptions using Graphql SPQR?

How to implement Subscription feature of GraphQL using Graphql SPQR library?
3
votes
1 answer

GraphQL and Spring Security using @PreAuthorize?

I have a problem setting up spring security and disabling/enabling access to jwt-authenticated role-based users for graphql services. All other REST endpoints are properly protected and JWT authentication and role-based authorization are working…
Wrapper
  • 794
  • 10
  • 25
3
votes
1 answer

How can we get HttpServletRequest(DefaultGlobalContext) for GraphQL from RequestContextHolder for GraphQL (using graphql-spqr-spring-boot-starter)?

I'm using graphql-spqr-spring-boot-starter library to migrate the existing Rest API project to GraphQL. I have a below piece of code to fetch the current HttpServletRequest from RequestContextHolder for Rest API: HttpServletRequest request =…
3
votes
2 answers

guidance on whether to use Annotation based spring boot graphql server

I am developing a new project with spring boot and graphql. I am confused on how to proceed because there are 2 ways to develop it, one is via the graphqls file and Annotation based approach. I prefer Annotation based approach but are they stable.…
3
votes
0 answers

graphql spqr Page MappingException

I try to use io.leangen.graphql.execution.relay.Page; Like this @GraphQLQuery public Page sysUsers(SysUser sysUser, @GraphQLArgument(name = "page", defaultValue = "1") int page, @GraphQLArgument(name = "size", defaultValue =…
EchoCow
  • 163
  • 8
3
votes
1 answer

Filtering nested fields, or mapping types to queries

Excuse the probably-basic question. I've used GraphQL SPQR to implement a fetch of a product DTO like so: @GraphQLQuery(name = "products") public Page getProducts(@GraphQLArgument(name = "count", defaultValue = "10") int count,…
S.V.
  • 1,181
  • 6
  • 23
3
votes
1 answer

GraphQL SPQR: id shall not be shown at creation

I use GraphQL SPQR with the entity @Entity public class MyEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private UUID id; @GraphQLNonNull @GraphQLQuery(name = "a", description = "Any field") private String…
Johannes Flügel
  • 3,112
  • 3
  • 17
  • 32
2
votes
0 answers

Graphql spqr does not produce any /graphql endpoint

I started creating a standard grapnel api following this tutorial and everything worked. Then I used spring-boot-graphql-spqr to get rid of the schema.graphql file and also the controller as the tutorial states. now, however, in the console there is…
1
2 3 4 5 6