-
Notifications
You must be signed in to change notification settings - Fork 1
Node Interface #20
Conversation
app/models/graph/schema.rb
Outdated
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.
Can also be better if we have model on metadata, think it would be cool
|
|
||
| object_from_id ->(id, query_ctx) do | ||
| gid = GlobalID.parse(id) | ||
| Object.const_get(gid.model_name).find(gid.model_id) |
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.
Maybe I'm a bit paranoid, but think we should do this?
type_name = uri.model_name.to_sym
if uri.app != GlobalID.app || !Graph::Types.constants.include?(type_name)
raise GraphQL::ExecutionError, "Invalid gid: #{gid}"
end
Object.const_get(gid.model_name).find(gid.model_id)|
|
||
| object_from_id ->(id, query_ctx) do | ||
| gid = GlobalID.parse(id) | ||
| possible_types = query_ctx.warden.possible_types(GraphQL::Relay::Node.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.
cc @cjoudrey good point, I think this is more even more accurate ^
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.
Nice! Forgot about this.
|
merging to keep going forward, let me know if you find anything else, will fix |
cc @cjoudrey