-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Enhance enumerable graph type determing #262
Conversation
Hello @tlil , what are you thinks about this PR? have any advice? |
I'd like to comment that in the main GraphQL.NET package we had an issue where dictionaries and classes that implemented list interfaces were identified as collection types. This was fixed in 5.1 in PR graphql-dotnet/graphql-dotnet#3099 . We restricted types that were identified as collection types to a set list, as follows:
Types that derived from these types would not be detected as a list. While the old behavior was retained for a time with a global switch, it has since been removed. Note that for auto-registering input types, GraphQL.NET must be able to reconstruct the list as well; to support more varied list types, we are adding Not sure how much of this applies here, but it seemed like it might be relevant, so I hope it helps. |
I think we need recognize derived type as enumerable graph type, because most type are using from 3rd party packages and they will possible use class as Properties insteadof interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response, @vcup. Thanks for putting this together. I've made some minor changes + added a test case for IDictionary
. But otherwise, LGTM
Thanks for this added context, @Shane32. Will keep that in mind going forward if similar issues arise from this change. |
Hello,
I've noticed that IReadOnlyList is not recognized as compatible with IEnumerable in schema generation, which may limit the library's functionality in some scenarios.
This PR updates the IsEnumerableGraphType(TypeInfo) method in ReflectionExtensions.cs to use a simple check:
type.GetGenericTypeDefinition() == interfaceType.GetGenericTypeDefinition()
.It will effect to GraphTypeInfo.cs#166 where marking the GraphTypeInfo.IsListType flag's logic.
Please consider merging this PR.