Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: add test confirming v16 schema compat #1054

Merged
merged 2 commits into from
Mar 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/definitions/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ export type NexusGraphQLInterfaceTypeConfig = WithExt<
> & { interfaces: () => GraphQLInterfaceType[] }

export interface NexusGraphQLSchema extends GraphQLSchema {
extensions: { nexus: NexusSchemaExtension }
extensions: {
nexus: NexusSchemaExtension
[attributeName: string]: unknown
}
}

export type NexusFeaturesInput = {
Expand Down
14 changes: 13 additions & 1 deletion tests/makeSchema.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { printSchema } from 'graphql'
import { GraphQLSchema, printSchema } from 'graphql'
import os from 'os'
import path from 'path'
import { objectType } from '../src'
Expand Down Expand Up @@ -151,4 +151,16 @@ describe('makeSchema', () => {
expect(tsTypes).toContain(`import type { Context } from "./makeSchema.spec"`)
})
})

it('is compatible with GraphQL schema types', () => {
const someFn = (schema: GraphQLSchema) => {
return schema.toConfig()
}

const nexusSchema = makeSchema({
types: [],
})

someFn(nexusSchema)
})
})
4 changes: 2 additions & 2 deletions tests/typegenPrinterGlobals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('typegenPrinter: globals', () => {
schema: path.join(__dirname, 'typegen-globals/schema.gen.graphql'),
} as const

const schema = (await generateSchema({
const schema = await generateSchema({
outputs,
shouldGenerateArtifacts: true,
types: [buildSchema(EXAMPLE_SDL)],
Expand All @@ -35,7 +35,7 @@ describe('typegenPrinter: globals', () => {

return content.replace("'nexus'", `'../../src'`)
},
})) as core.NexusGraphQLSchema
})

metadata = new TypegenMetadata({
outputs,
Expand Down