-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
autobind on multiple packages has strange priority #845
Comments
fixed by #872 |
Despite upgrading to
|
Sorry if that pr wasn't clear, you can now use the short package name as long as it's on the autobinl path eg "model.User" |
I noticed indeed, but this does not solve the issue here. What I aim to do is to use the autobind feature to avoid mapping each schema's type to a package's type. Here, I need...
To do so, I declared in the autobind:
- graphqlapi
- httpapi But when I do so, the graphqlapi types are never used: gqlgen uses httpapi package for both My current workaround consists in hand mapping each type, but I would want gqlgen to "first look into graphqlapi, if the model is missing, look into httpapi". But doing so, I end up with a lot of lines in the model mapping, which could be easily discarded. Do you think that this could be solved ? |
Ok that sounds like a bug, it's meant to be a priority search path with the short package syntax to override when there is a type name collision |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What happened?
When setting multiple
autobind
values, witch package containing a type with a similar name, there is no way to force priority.What did you expect?
For each type, I expect gqlgen to do the binding with the first package in "autobind", and fallback to the second (and so on...) if the model is not found.
In my example:
ProjectFilter
tographqlapi.ProjectFilter
Project
tohttpapi.Project
httpapi.ProjectFilter
Minimal graphql.schema and models to reproduce
versions
The text was updated successfully, but these errors were encountered: