Schema with unions throws NullReferenceException
See original GitHub issueHi!
Looks like it is currently not possible to generate a client from a schema that contains Union types. In Snowflaqe we get a Object reference not set to an instance of an object, but we (@margaretkrutikova and @danielstarck) tracked it down to the following line in graphql-dotnet. The problem is that when called like this, both union.ResolveType and union.IsTypeOf are null.
Not sure if we should open an issue there, since it’s not entirely clear to me whether the way it is called from Snowflaqe is the intended usage. The examples in graphql-dotnet docs provide the actual types when calling Schema.For, while Snowflaqe only provides the shcema string. Please advice.
I’ve opened a PR with a simple repro here: https://github.com/Zaid-Ajaj/Snowflaqe/pull/69
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
@MargaretKrutikova thanks a lot for digging into this! It saves me a lot of time debugging 🙏 I understand the problem better now and the fix looks great to me, if you include it in the PR #69, I would be happy to merge and publish a new version of Snowflaqe
Hi @Zaid-Ajaj, and thanks for the quick reply! Unfortunately it might not be a regression (at least not in the latest version), as I’ve tried both 1.36.0 as well as 1.34.0, and both return the same error message.
I’ve tried running both versions against a JSON-schema as you suggested, and both work smoothly. Not sure if it helps though, since the operation that fails is the one that is trying to convert the SDL to JSON itself.