[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Union types combined with schema sorting stop working. Everything works fine until I try to query some data using inline fragment - server responds with empty object regardless of properties I've requested in the fragment.
I should say that the bug can be reproduced not only with sortSchema option, but also using lexicographicSortSchema.
Example of not working code on the current package version.
|
|
| Query | Response |
|
|
I should get the data I've requested in the query.
Example of working code on the current package version. This behavior is also expected when using sorting.
GraphQLModule.forRoot({
playground: true,
autoSchemaFile: 'schema.gql',
sortSchema: false,
})
| Query | Response |
|
|
I've prepared the repository. Steps to reproduce:
npm installsrc/app.module.ts and tweak options according to the commentsnpm run devlocalhost:3000For me personally, it doesn't make much difference to have schema sorting enabled or not, but it was not obvious for me that the issue was caused by the sorting option.
Actually I'm not sure if it's an issue with nestjs and should we fix it at all. But it took me a lot of time to found this behavior and at least I hope to help someone that may face the same issue.
If it's not the issue with nestjs or it won't be fixed, I think this behavior should be mentioned in the nestjs docs.
Nest version: ^7.4.2
Nest Graphql version: ^7.6.0
For Tooling issues:
- Node version: v14.8.0
- Platform: Linux
Others:
Ubuntu 20.04.1 LTS
NPM 6.14.6
Also, I didn't find any similar issues, not in nestjs repository nor the graphql repository. That's why my assumption is that this bug is reproducible only with nestjs.
Just ran into the same issue with a different Nest version:
Nest version: ^7.0.0
Nest Graphql version: ^7.6.0
@mattleff would you like to take a look into this PR? It seems to be related to the feature you've added.
@kamilmysliwiec I'll take a look soon.
This was fixed upstream with https://github.com/graphql/graphql-js/pull/2793. A release hasn't been cut yet.