module ApolloFederation::Schema::CommonMethods
Public Instance Methods
federation_sdl(context: nil)
click to toggle source
# File lib/apollo-federation/schema.rb, line 19 def federation_sdl(context: nil) document_from_schema = FederatedDocumentFromSchemaDefinition.new(self, context: context) GraphQL::Language::Printer.new.print(document_from_schema.document) end
Private Instance Methods
federation_query(query_obj)
click to toggle source
# File lib/apollo-federation/schema.rb, line 26 def federation_query(query_obj) # Build the new query object with the '_service' field if query_obj.nil? base = GraphQL::Schema::Object elsif Gem::Version.new(GraphQL::VERSION) >= Gem::Version.new('1.10.0') base = query_obj else base = query_obj.metadata[:type_class] end klass = Class.new(base) do # TODO: Maybe the name should inherit from the original Query name # Or MAYBE we should just modify the original class? graphql_name 'Query' include EntitiesField include ServiceField end klass.define_service_field klass end