-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
Create custom attribute to modify members behaviour within type queried by UseSelection middleware #1533
Comments
Thank you for reporting this:
|
@PascalSenn so what is the bug here? Regarding the metadata ... Yes, something like that is coming in version 11 with the new execution engine. |
@michaelstaib
|
Ah I see. OK |
@rankdalibor Pushed a few fixes. Can you check with the following version? https://github.com/ChilliCream/hotchocolate/releases/tag/10.4.0-preview.19 |
I think this was incorrectly tagged. It appears that 10.4.0-preview.18 tag is on the same commit as 11.0.0-preview.109. Also, the CI for the 10.4.0-preview.18 is failing, I don't see any published nuget packages for it, and I also cannot find any code related to the selection middleware in the 10.4.0-preview.18 tag. Meanwhile, I do see the changes in the version_10_0_0_master branch. Perhaps the wrong branch was tagged for the release? |
@TheJayMann You are right, there went something wrong: |
I can confirm that an error related to a method inside selection type is now fixed 👍 |
I've been trying out feature made with #1446 and i've noticed couple of things i think should behave a bit different.
Let's have following context:
When i query just
id
,title
or both of them, i get what i need, and query is optimized properly. But when i includetags
as well, query throws an exception:UseSelection is in a invalid state. Field tags should never have been visited!
.Now, i understand that method that has it's own resolver (whatever it is) can't be part of the query, but i think this can be handled in a better way, not only for the purpose of having methods here, but excluding any field we don't want to be a part of the actual IQueryable expression.
My idea is to have a universal attribute here, called
SelectionField
or something similar. It could have multiple purposes, but one of them could be following:This way we could ommit specific members we don't want to be a part of the query. Any field we don't annotate with this attribute can be considered as included, and equal to
[SelectionField(Included = true)]
.I mentioned the
SelectionField
attribute in the previous point, and i think it could be used for something else as well, and that is specifying mandatory fields that should get included in dynamic expression, whether or not we requested it with GraphQL query. It won't get projected to us, of course, but it will be queried in the background.As you can see, it is sometimes useful to know that some field would always have data (
Id
in this case), because we may need it for some calculations, 3rd party service calls and similar.The text was updated successfully, but these errors were encountered: