You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm building up a tree of heterogeneous data. In order to do so, I have a Types::IntegrationNode module that each of the node types implement. E.g.:
classTypes::AwsIntegrationType < Types::BaseObjectimplementsGraphQL::Types::Relay::NodeimplementsTypes::IntegrationNode
...
end
The problem is I can't define a method for any of the implemented fields from the implementing type. E.g., if Types::IntegrationNode declares field :name, String, null: false, I can't define Types::AwsIntegrationType#name. Instead, I see an error like:
Failed to implement IntegrationNode.name, tried:
- `Types::IntegrationServiceTreeType#name`, which did not exist
- `AwsIntegration#name`, which did not exist
- Looking up hash key `:name` or `"name"` on `#<AwsIntegration:0x00007f1438b370b0>`, but it wasn't a Hash
To implement this field, define one of the methods above (and check for typos)
This appears to be inconsistent with how fields declared directly in the type are handled, where I can define a method with the same name and have that used as the implementation.
Describe the solution you'd like
I'd like to be able to define a method corresponding to a field from an implemented interface and have that method invoked as if the field were defined directly in the type.
Describe alternatives you've considered
The error message clearly lists where I can define the method. Adding it to the interface isn't appropriate since I need it overridden in each concrete type. That leaves defining the methods on AwsIntegration, which works.
The text was updated successfully, but these errors were encountered:
Thanks for the detailed report. It's supposed to work the way you describe, where def name in the object type takes precedence over any method defined in an interface module!
I tried to make a simple reproduction of this issue in eafe432, but for me, it worked fine. Could you share an example query that gives this issue? Maybe there's a certain runtime scenario that surfaces the bug.
Is your feature request related to a problem? Please describe.
I'm building up a tree of heterogeneous data. In order to do so, I have a
Types::IntegrationNode
module that each of the node types implement. E.g.:The problem is I can't define a method for any of the implemented fields from the implementing type. E.g., if
Types::IntegrationNode
declaresfield :name, String, null: false
, I can't defineTypes::AwsIntegrationType#name
. Instead, I see an error like:This appears to be inconsistent with how fields declared directly in the type are handled, where I can define a method with the same name and have that used as the implementation.
Describe the solution you'd like
I'd like to be able to define a method corresponding to a field from an implemented interface and have that method invoked as if the field were defined directly in the type.
Describe alternatives you've considered
The error message clearly lists where I can define the method. Adding it to the interface isn't appropriate since I need it overridden in each concrete type. That leaves defining the methods on
AwsIntegration
, which works.The text was updated successfully, but these errors were encountered: