-
-
Notifications
You must be signed in to change notification settings - Fork 611
Open
Description
Summary
https://postgraphile.org/postgraphile/5/node-id says:
You can create your plugin similar to the following:
const IdToNodeIdPlugin: GraphileConfig.Plugin = {
name: "IdToNodeIdPlugin",
version: "1.0.0",
inflection: {
replace: {
nodeIdFieldName() {
return "nodeId";
},
_attributeName(previous, options, details) {
const attribute = codec.attributes[attributeName];
const name = attribute.extensions?.tags?.name || attributeName;
return this.coerceToGraphQLName(name);
},
},
},
};The snippet above is missing the following line in the _attributeName function body:
const { codec, attributeName } = details;
Without it the code is not valid.
Correct snippet
const IdToNodeIdPlugin: GraphileConfig.Plugin = {
name: "IdToNodeIdPlugin",
version: "1.0.0",
inflection: {
replace: {
nodeIdFieldName() {
return "nodeId";
},
_attributeName(previous, options, details) {
+ const { codec, attributeName } = details;
const attribute = codec.attributes[attributeName];
const name = attribute.extensions?.tags?.name || attributeName;
return this.coerceToGraphQLName(name);
},
},
},
};Additional context
Sorry, I do not have time to add this to the docs myself.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
🌳 Triage