module ApolloFederation::Schema::OneTenMethods
Public Instance Methods
query(new_query_object = nil)
click to toggle source
Calls superclass method
# File lib/apollo-federation/schema.rb, line 71 def query(new_query_object = nil) if new_query_object @orig_query_object = new_query_object else if !@federation_query_object @federation_query_object = federation_query(@orig_query_object) @federation_query_object.define_entities_field(schema_entities) super(@federation_query_object) end super end end
Private Instance Methods
schema_entities()
click to toggle source
# File lib/apollo-federation/schema.rb, line 88 def schema_entities # Create a temporary schema that inherits from this one to extract the types types_schema = Class.new(self) # Add the original query objects to the types. We have to use orphan_types here to avoid # infinite recursion types_schema.orphan_types(@orig_query_object) # Walk through all of the types and determine which ones are entities (any type with a # "key" directive) types_schema.types.values.select do |type| # TODO: Interfaces can have a key... !type.introspection? && type.include?(ApolloFederation::Object) && type.federation_directives&.any? { |directive| directive[:name] == 'key' } end end