This repository was archived by the owner on Dec 19, 2023. It is now read-only.
GraphQLAnnotationsAutoConfiguration should not include irrelevant types in the generated schema #502
Labels
Milestone
Is your feature request related to a problem? Please describe.
When using GraphQL-Java Annotations and when using Java interfaces and abstract classes for backing GraphQL interfaces then irrelevant types are added to the generated GraphQL schema.
Given the
Character
interface and theHuman
andDroid
types as used throughout the Introduction to GraphQL:And given I want to use the same classes for both defining the GraphQL schema and as JPA entities.
Then my classes will look something like this:
Both
AbstractCharacter implements Character
andDroid
/Human extends AbstractCharacter implements Character
are required in order to satisfy the needs of GraphQL-Java Annotations and JPA.The schema generated by GraphQL-Java Annotations's
AnnotationsSchemaCreator
will contain these types:That's 100 % matching my expectations.
In contrast, the schema generated by
GraphQLAnnotationsAutoConfiguration
will contain these types:The
AbstractCharacter
type has no relevance to the GraphQL schema.Describe the solution you'd like
I would like
GraphQLAnnotationsAutoConfiguration
to not add theAbstractCharacter
type to the schema. Excluding all abstract classes would be an obvious approach which would work perfectly fine for my use case but which may constitute a breaking change for other users.If inavoidable, I would be fine with having to mark that class for exclusion.
Additional context
Please find an example project with a Spring Boot test for reproducing the behavior described above in the attached
graphql-spring-boot-annotations.zip file.
The text was updated successfully, but these errors were encountered: