Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mercurius-js/mercurius
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Feb 10, 2023
2 parents a064494 + a3eb6ba commit bb8447b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
Expand Down
4 changes: 2 additions & 2 deletions docs/integrations/nestjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

NestJS offers Fastify and Mercurius support out of the box. It also supports both schema and code-first approaches to development. We'll be covering the code-first approach, as it is used more commonly.

> **Note**: Support for NestJS can be found at their [Discord server](https://discord.gg/ErA7cNkK).
> **Note**: Support for NestJS can be found at their [Discord server](https://discord.com/invite/G7Qnnhy).
## Installation

Expand Down Expand Up @@ -224,6 +224,6 @@ This is just a short and rough example of how to get going with NestJS and Mercu

If you'd like to continue with Nest and Mercurius and learn more about Nest, please do read the [documention on the NestJS website](https://docs.nestjs.com/). The two make a really great combination in terms of developer experience.

Should you need any help with Nest, they have a [great support community](https://discord.gg/ErA7cNkK). Please go there for support with NestJS questions or issues.
Should you need any help with Nest, they have a [great support community](https://discord.com/invite/G7Qnnhy). Please go there for support with NestJS questions or issues.


4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ const plugin = fp(async function (app, opts) {
...fields[prop],
...resolver[prop]
}
} else if (prop === '__resolveReference') {
// TODO Investigate a way to remove this requirement
// Required to integrate the gateway
type.resolveReference = resolver[prop]
} else if (fields[prop]) {
fields[prop].resolve = resolver[prop]
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@fastify/websocket": "^7.0.0",
"fastify-plugin": "^4.2.0",
"graphql": "^16.0.0",
"graphql-jit": "^0.7.3",
"graphql-jit": "^0.8.0",
"mqemitter": "^5.0.0",
"p-map": "^4.0.0",
"readable-stream": "^4.0.0",
Expand Down
27 changes: 27 additions & 0 deletions test/app-decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1407,3 +1407,30 @@ test('support ast input on external requests', async (t) => {
}
})
})

test('defineResolvers should support __resolveReference', async (t) => {
const app = Fastify()
const schema = `
type Query {
me: User
}
type User {
id: String
}
`
const resolvers = {
User: {
__resolveReference: async () => ({ id: 1 })
}
}

app.register(GQL, { schema })

app.register(async function (app) {
app.graphql.defineResolvers(resolvers)
t.pass('No errors occurred')
})

// needed so that graphql is defined
await app.ready()
})

0 comments on commit bb8447b

Please sign in to comment.