GraphQL links not working #30157
-
Hi guys/girls, Writing my first gatsby source plugin #superexcited. "allSalonizedAppointments": {
"nodes": [
{
"customer_id": "7508867",
"id": "27201514",
"customer": null
}
]
},
"allSalonizedCustomers": {
"nodes": [
{
"first_name": "John",
"last_name": "Doe",
"id": "7508867"
},
{
"first_name": "Jane",
"last_name": "Doe",
"id": "7522368"
}
]
}
}, As you can see I've already added a "customer" field, trying to populate it with salonizedCustomer type. GraphQL already finds all fields, but the link is giving me issues: exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes } = actions;
createTypes(`
type salonizedAppointments implements Node {
customer_id: String!
customer: salonizedCustomers @link(from: "salonizedCustomers.id" by: "customer_id")
}
type salonizedCustomers implements Node {
id: String!
}
`);
}; I've already tried using other syntax using the more explicit syntax, but to no avail. Some help would be really appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Try something like this instead: exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes } = actions;
createTypes(`
type salonizedAppointments implements Node {
customer_id: String!
customer: salonizedCustomers @link(from: "customer_id")
}
type salonizedCustomers implements Node {
id: String!
}
`);
}; |
Beta Was this translation helpful? Give feedback.
Try something like this instead: