-
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
Generate Getters for Interface Fields #1469
Comments
This change makes a ton of sense and would make coding against interfaces a lot simpler. |
Hit this issue today; this will make the generated interfaces actually useful. |
This really should be something that is supported. It is extremely cumbersome to get around this as there is really only 1 way to get the func GetValue(foo Foo) string {
switch f := foo.(type) {
case FooA:
return f.Value
case FooB:
return f.Value
}
return ""
} If a new field is added to the interface graphql schema another helper function will need to be added. These have to be implemented in helper packages and adds more complexity than is really needed as opposed to just generating the Getters. |
If anyone is still wanting this functionality, feel free to review #2314 and let me know if it matches your expectations |
Currently, when you have a schema like this:
The generated go file will look like this:
Additionally, it would be great to also generate getters for all interface fields. This makes using typeswitches obsolet when you're not interested in the underlying type.
The text was updated successfully, but these errors were encountered: