graphile / graphile/federation

Couldn't add schema extension plugin extend type of another service

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
41
Forks
11
PR merge metrics
No merged PRs in 30d

Description

I would like to add a schema extension plugin in this nodejs Postgraphile server to pointing to another type in another GraghQL service. The other service is running with Apollo Server. Then would like to register both GrqphQL with Apollo Gateway.
However, in my plugin:

```js
const { makeExtendSchemaPlugin, gql } = require("graphile-utils");

const SchemaExtensionPlugin = makeExtendSchemaPlugin(build => {
// Get any helpers we need from `build`
const { pgSql: sql, inflection } = build;
return {
typeDefs: gql`
extend type Query {
ThingLinked: [ThingLinkedProduct]
}

type ThingLinkedProduct @key(fields: "id") {
id: Int!
name: String
product: Product
}

extend type Product @key(fields: "upc") {
upc: String! @external
}
`,
resolvers: {...}
};
});

export default SchemaExtensionPlugin;
```

Error:

```
Error: Could not find type named 'Product'.
at getType (C:\Workspace\EMCP\node_modules\graphile-utils\src\makeExtendSchemaPlugin.ts:516:15)
at C:\Workspace\EMCP\node_modules\graphile-utils\src\makeExtendSchemaPlugin.ts:755:24
```

I even tried to add Apollo's buildFederatedSchema API in this extension, got different error.

Is this feature supported?

I'm able to add 'extend type' the other way around. Added 'extend type' from here to the other Apollo Server GraphQL, and Apollo gateway can query this one using nodeId

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.