Hello!! I am trying to convert one of my object types to an entity, but when I pushed the subgraph to my federated graph, the type didn't show up with the @key directive, so I got a composition error when I tried to push the schema for the other subgraph where I want to reference this type.
Then, I tried outputting the schema locally with File.write("schema.graphql", Schema.federation_sdl), and the result was the same -- directive not included.
class MyObjectType < Types::BaseObject
key fields: :id
graphql_name 'MyObject'
description 'Example'
field :id, ID, null: false
# ...other fields
end
Then, I have my BaseObject defined like so:
require 'apollo-federation'
module Types
class BaseObject < GraphQL::Schema::Object
include ApolloFederation::Object
field_class BaseField
end
end
BaseField
require 'apollo-federation'
module Types
class BaseField < GraphQL::Schema::Field
include ApolloFederation::Field
end
end
Schema
require 'apollo-federation'
class Schema < GraphQL::Schema
include ApolloFederation::Schema
mutation Graph::MutationType
query Graph::QueryType
def self.resolve_type(abstract_type, object, context)
raise "You need to define resolve_type in #{abstract_type}"
end
use GraphQL::Execution::Execute
use GraphQL::Analysis
end
I tried putting a debugger in ApolloFederation::HasDirectives#add_directive, and that seems to be getting hit with the correct key that needs to be added, so I'm puzzled as to why it doesn't end up in the SDL output.
For reference, I am using apollo-federation 3.8.3 and graphql 1.12.24
Hello!! I am trying to convert one of my object types to an entity, but when I pushed the subgraph to my federated graph, the type didn't show up with the
@keydirective, so I got a composition error when I tried to push the schema for the other subgraph where I want to reference this type.Then, I tried outputting the schema locally with
File.write("schema.graphql", Schema.federation_sdl), and the result was the same -- directive not included.Then, I have my BaseObject defined like so:
BaseField
Schema
I tried putting a debugger in
ApolloFederation::HasDirectives#add_directive, and that seems to be getting hit with the correct key that needs to be added, so I'm puzzled as to why it doesn't end up in the SDL output.For reference, I am using apollo-federation 3.8.3 and graphql 1.12.24