Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.03k stars 286 forks source link

bug: unmapped fields after version upgrade when using dgs.graphql.schema-locations #1885

Closed stefan-kueenzi closed 2 months ago

stefan-kueenzi commented 2 months ago

Please read our contributor guide before creating an issue.

Expected behavior

There are no unmapped fields in the GraphQL schema inspection

Actual behavior

All queries and mutation are logged as unmapped fields.

Steps to reproduce

Create a new repository with spring-boot 3.2.4 and dgs-framework 8.55 with the following files image

When the test.graphqls file is in a folder called graphql and the following parameter is used: dgs.graphql.schema-locations=classpath*:graphql/**/*.graphql* We have the following logs on startup ''' 2024-04-17T22:40:39.784+02:00 INFO 29856 --- [dgsissue] [ main] efaultSchemaResourceGraphQlSourceBuilder : Loaded 1 resource(s) in the GraphQL schema. 2024-04-17T22:40:40.329+02:00 INFO 29856 --- [dgsissue] [ main] o.s.b.a.g.GraphQlAutoConfiguration : GraphQL schema inspection: Unmapped fields: {Query=[currentUserProfile]} Unmapped registrations: {} Skipped types: [] '''

After renaming the folder to schema and removing the parameter dgs.graphql.schema-locations everything works fine

We tried to upgraded DGS from 7.2.0 to 8.5.5 and spring-boot from 3.1.3 to 3.2.4, after which the issue occurred. The setup worked fine before.

Test repository: https://github.com/stefan-kueenzi/dgsissue

paulbakker commented 2 months ago

During the upgrade you also switched to the Spring GraphQL integration, right?

stefan-kueenzi commented 2 months ago

No we only changed the version. There was no switch to Spring GraphQL integration. I uploaded my sample project. I hope it's not my mistake 😁

https://github.com/stefan-kueenzi/dgsissue

paulbakker commented 2 months ago

Thanks for sharing the repo, that made things easy.

Your dependencies were incorrect, you actually had dependencies on Spring GraphQL directly (not even the dgs integration).

I created a PR on your repo, it works with that set of dependencies. https://github.com/stefan-kueenzi/dgsissue/pull/1

stefan-kueenzi commented 2 months ago

Thanks a lot for your quick help! I've changed it in my repository and it works fine like that. So I guess the incorrect dependencies worked with the older version and doesn't anymore. I hope the wrong bug report at least helps somebody else who has the same issue 😁

paulbakker commented 2 months ago

I have no idea how it previously worked, it really shouldn't have.

Now that you're upgraded, I do recommend you also upgrade to the DGS/Spring GraphQL integration, since that's going to be the long term path forward as described here: https://netflix.github.io/dgs/spring-graphql-integration/

On Thu, Apr 18, 2024 at 5:45 AM Stefan Küenzi @.***> wrote:

Thanks a lot for your quick help! I've changed it in my repository and it works fine like that. So I guess the incorrect dependencies worked with the older version and doesn't anymore. I hope the wrong bug report at least helps somebody else who has the same issue 😁

— Reply to this email directly, view it on GitHub https://github.com/Netflix/dgs-framework/issues/1885#issuecomment-2063781701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2XLH6S5P27ND5WG2KNATY5656ZAVCNFSM6AAAAABGMBCFIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTG44DCNZQGE . You are receiving this because you modified the open/close state.Message ID: @.***>