You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
If I replace makeAugmentedSchema with makeExecutableSchema then everything works as expected.
The __resolveType resolver is never called when using makeAugmentedSchema, but is called as expected when makeExecutableSchema is used.
If I use makeExecutableSchema and comment out the __resolveType resolver, then it produces the same error as makeAugmentedSchema does in either case (see error below).
Using a __isTypeOf resolver has the same issue (is never called with makeAugmentedSchema).
Changing the ids to something else, as this issue suggests, doesn't help.
Query:
queryVehicle {
vehicle {
__typenameid
}
}
Error:
"Abstract type "Vehicle" must resolve to an Object type at runtime for field "Query.vehicle". Either the "Vehicle" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function."
Schema:
// import { makeExecutableSchema } from 'apollo-server-express';import{makeAugmentedSchema}from'neo4j-graphql-js';exportconstschema=makeAugmentedSchema({typeDefs: /* GraphQL */` interface Vehicle { id: ID! } type Truck implements Vehicle { id: ID! payload: Int } type Bus implements Vehicle { id: ID! passengers: Int } type Query { vehicle: Vehicle } `,resolvers: {Vehicle: {__resolveType(vehicle: {readonlytype: 'Truck'|'Bus'}){console.log('__resolveType',vehicle);returnvehicle.type;},},Truck: {id(){console.log('Truck ID');return'Truck ID';},},Bus: {id(){console.log('Bus ID');return'Bus ID';},},Query: {vehicle(){consttype=Math.random()>0.5 ? 'Truck' : 'Bus';console.log('type',type);return{
type,};},},},});
The text was updated successfully, but these errors were encountered:
Consider the contrived example below.
makeAugmentedSchema
withmakeExecutableSchema
then everything works as expected.__resolveType
resolver is never called when usingmakeAugmentedSchema
, but is called as expected whenmakeExecutableSchema
is used.makeExecutableSchema
and comment out the__resolveType
resolver, then it produces the same error asmakeAugmentedSchema
does in either case (see error below).__isTypeOf
resolver has the same issue (is never called withmakeAugmentedSchema
).id
s to something else, as this issue suggests, doesn't help.Query:
Error:
Schema:
The text was updated successfully, but these errors were encountered: