Module: GraphitiGraphQL::Federation

Defined in:
lib/graphiti_graphql/federation.rb,
lib/graphiti_graphql/federation/resource_dsl.rb,
lib/graphiti_graphql/federation/loaders/has_many.rb,
lib/graphiti_graphql/federation/schema_decorator.rb,
lib/graphiti_graphql/federation/federated_resource.rb,
lib/graphiti_graphql/federation/loaders/belongs_to.rb,
lib/graphiti_graphql/federation/federated_relationship.rb,
lib/graphiti_graphql/federation/apollo_federation_override.rb

Defined Under Namespace

Modules: EntitiesFieldOverride, Loaders, ResourceDSL Classes: FederatedRelationship, FederatedResource, SchemaDecorator

Class Method Summary collapse

Class Method Details

.setup!Object

  • Extend Graphiti::Resource with federated_* macros

  • Add apollo-federation modules to graphql-ruby base types

  • Mark federation = true for checks down the line



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/graphiti_graphql/federation.rb', line 37

def self.setup!
  Graphiti::Resource.send(:include, ResourceDSL)
  schema = GraphitiGraphQL::Schema
  schema.base_field = Class.new(schema.base_field) do
    include ApolloFederation::Field
  end
  schema.base_object = Class.new(schema.base_object) do
    include ApolloFederation::Object
  end
  schema.base_object.field_class(schema.base_field)
  schema.base_interface = Module.new do
    include GraphQL::Schema::Interface
    include ApolloFederation::Interface
  end
  schema.base_interface.field_class(schema.base_field)
  GraphitiGraphQL::Schema.federation = true
end