-
Notifications
You must be signed in to change notification settings - Fork 14
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
Can not map enums when using GraphQLFragment, no errors when building query #99
Comments
I am using Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.9.5 |
Tested in Microsoft Visual Studio Enterprise 2022 (64-bit) (v. 17.9.6) with same result |
I managed to reproduce this case. It should report the error.
The fragment should not be treated as a C# function. It is more like GraphQL query declaration powered by C# syntax. It is analyzed at compile time to bake everything into proper raw GraphQL query. At the moment, the source generator supports the limited C# syntax tree to simplify the implementation and improve performance. |
Checkout v6.2.1-preview.1. The missing error message has been fixed in v6.2.0. The v6.2.1-preview.1 adds support for casting enums. |
Describe the bug
When using GraphQLFragment, it is unclear how Enums should be mapped
Also when doing this, there is no exception when sending or building query - query will be build, but won't select any fields that will lead to exception on GraphQL server.
Am I missing something or this is not possible?
How to Reproduce
Code example, simple query towards GraphQL api and mapping result to read model using fragments (see graphQL schema below)
Query:
query ($where: PersonFilterInput!) { persons(where: $where) { } } }
(query does not select any fields)After removing Enum convertion everything works fine (all other fields are selected)
Then this query obviously returns error when running it (as you can not have query which is not selecting any fields)
Expected behavior
Ability to map enum and/or exception message saying that query is impossible to build
Today, if you use same query (with type casting) inside selector, it will be recognized as error.
The GraphqQL schema that fails
If applicable, there is no need to post the whole schema, but having the small part that causes the issue would be excellent.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: