Skip to content

Instantly share code, notes, and snippets.

@paolochiodi
Created January 28, 2022 14:33
Show Gist options
  • Save paolochiodi/93a75b1b1cd551a745b6d8d77f83e1a4 to your computer and use it in GitHub Desktop.
Save paolochiodi/93a75b1b1cd551a745b6d8d77f83e1a4 to your computer and use it in GitHub Desktop.
Repro for mercurius-validation nullable types issue
'use strict'
const Fastify = require('fastify')
const mercurius = require('mercurius')
const mercuriusValidation = require('mercurius-validation')
const assert = require('assert')
const app = Fastify()
const schema = `
type Query {
test(in: String): String
}
`
const resolvers = {
Query: {
test: async (_, args) => {
assert(args.in === null)
return 'it works'
}
}
}
app.register(mercurius, {
schema,
resolvers
})
app.register(mercuriusValidation)
app.listen(3210)
{
"name": "test-graphql",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"fastify": "^3.27.0",
"graphql": "^15.8.0",
"mercurius": "^8.12.0",
"mercurius-validation": "^1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment