Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-registration of @GraphQlRepository doesn't work if the returned list is declared not null #661

Closed
andreysubbotin opened this issue Apr 7, 2023 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@andreysubbotin
Copy link

Example query:

"Query root"
type Query {
  petList: [Pet]!
}

Data Repository:

@GraphQlRepository
public interface PetRepository extends JpaRepository<Pet, Long>, QuerydslPredicateExecutor<QPet> {
}

AR: Spring GraphQL unable to handle petList query.
Perhaps, GraphQL type is not resolved correctly in org.springframework.graphql.data.query.AutoRegistrationRuntimeWiringConfigurer.AutoRegistrationWiringFactory#getOutputTypeName.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 7, 2023
@rstoyanchev
Copy link
Contributor

The Java type name QPet doesn't match the GraphQL type name Pet, so auto-registration won't match them for use with Querydsl. However, it should match the Pet from JpaRepository for use with Query By Example.

I think there is indeed an issue with a not null list specifically, which should be fixed in 1.2 snapshots as a result of a recent change. However, it needs to be backported to 1.1. Can you confirm it does work if the list is nullable?

@rstoyanchev rstoyanchev changed the title @GraphQlRepository doesn't work for not null list result Auto-registration of @GraphQlRepository doesn't work if the returned list is declared not null Apr 12, 2023
@rstoyanchev rstoyanchev removed the status: waiting-for-triage An issue we've not yet triaged label Apr 12, 2023
@rstoyanchev rstoyanchev self-assigned this Apr 12, 2023
@rstoyanchev rstoyanchev added the type: bug A general bug label Apr 12, 2023
@rstoyanchev rstoyanchev added this to the 1.1.4 milestone Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants