Why is GraphiQL not auto completing/finding my interface fields?
Я пытаюсь использовать interface
в моем schema
, Здесь schema
:
export default new GraphQLObjectType({
name: "Org",
fields: () => ({
name: {
type: GraphQLString
},
paymentType: {
type: PaymentType,
resolveType: ({ isCreditCard }) => isCreditCard ? CreditCard : ACH
}
});
export const PaymentType = new GraphQLInterfaceType({
name: "PaymentType",
fields: () => ({
id: {
type: new GraphQLNonNull(GraphQLID)
},
name: {
type: new GraphQLNonNull(GraphQLString)
},
address: {
type: new GraphQLNonNull(Address)
}
})
});
export const CreditCard = new GraphQLObjectType({
name: "CreditCard",
interfaces: [PaymentType],
fields: () => ({
number: new GraphQLNonNull(GraphQLInt),
})
});
export const ACH = new GraphQLObjectType({
name: "ACH",
interfaces: [PaymentType],
fields: () => ({
routing: new GraphQLNonNull(GraphQLInt),
accountNumber: new GraphQLNonNull(GraphQLInt),
})
});
When I go to my GraphiQL
Я могу видеть paymentType
and the fields that are in the interface
, but I can't see the CreditCard
или же ACH
Информация. I must have something set up wrong? Что мне не хватает?
1 ответ
Используете ли вы тип (CreditCard или ACH) для запроса, например?