Describe the bug
In v 0.10.0, enum resolvers are automatically generated, but this doesn't seem to play nice with the buildSubgraphSchema function (at least from @apollo/federation v0.38.1). Ends up with an error similar to below:
TS2345: Argument of type
{ typeDefs: DocumentNode; resolvers: Resolvers; }
is not assignable to parameter of type
DocumentNode | (DocumentNode | GraphQLSchemaModule)[] | LegacySchemaModule
Types of property resolvers are incompatible.
Type Resolvers is not assignable to type GraphQLResolverMap<any>
Property IntegrationsConnectionType is incompatible with index signature.
Type 'EnumResolverSignature<{ ValueOne?: any; ValueTwo?: any; }, ResolverTypeWrapper<"ValueOne" | "ValueTwo">>' is not assignable to type 'GraphQLScalarType<unknown, unknown> | { [enumValue: string]: string | number; } | { [fieldName: string]: GraphQLFieldResolver<any, any, any> | { requires?: string | undefined; resolve: GraphQLFieldResolver<...>; }; }'.
Type 'EnumResolverSignature<{ ValueOne?: any; ValueTwo?: any; }, ResolverTypeWrapper<"ValueOne" | "ValueTwo">>' is not assignable to type '{ [fieldName: string]: GraphQLFieldResolver<any, any, any> | { requires?: string | undefined; resolve: GraphQLFieldResolver<any, any, any>; }; }'.
Property ValueOne is incompatible with index signature.
Type 'ResolverTypeWrapper<"ValueOne" | "ValueTwo">' is not assignable to type 'GraphQLFieldResolver<any, any, any> | { requires?: string | undefined; resolve: GraphQLFieldResolver<any, any, any>; }'.
Type 'string' is not assignable to type 'GraphQLFieldResolver<any, any, any> | { requires?: string | undefined; resolve: GraphQLFieldResolver<any, any, any>; }'
To ReproduceSteps to reproduce the behavior:
Using a graphql schema including an enum type, eg:
type Query {
someTypeFetch: SomeType!
}
enum SomeEnum {
ValueOne
ValueTwo
}
type SomeType {
someEnum: SomeEnum!
}
Describe the bug In v 0.10.0, enum resolvers are automatically generated, but this doesn't seem to play nice with the
buildSubgraphSchema
function (at least from@apollo/federation
v0.38.1). Ends up with an error similar to below:To Reproduce Steps to reproduce the behavior: Using a graphql schema including an enum type, eg:
Create a corresponding typescript enum:
With a yml config (simplified, might not be 100% correct):
Removing
enumValues
, and playing around with adding or removingmappers
doesn't seem to change the outcomeExpected behavior Using a mapped enum works as expected
Additional context Reverting back to 0.9.2 resolves the issue