Skip to content
Open
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
58 changes: 58 additions & 0 deletions src/type/__tests__/introspection-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,64 @@ describe('Introspection', () => {
});
});

it('returns null for descriptions of wrapping types', () => {
const schema = buildSchema(`
"""Object description"""
type SomeObject {
listField: [SomeObject]
nonNullField: SomeObject!
}

schema {
query: SomeObject
}
`);

const source = `
{
__type(name: "SomeObject") {
description
fields {
name
type {
kind
description
ofType {
description
}
}
}
}
}
`;

expect(graphqlSync({ schema, source })).to.deep.equal({
data: {
__type: {
description: 'Object description',
fields: [
{
name: 'listField',
type: {
kind: 'LIST',
description: null,
ofType: { description: 'Object description' },
},
},
{
name: 'nonNullField',
type: {
kind: 'NON_NULL',
description: null,
ofType: { description: 'Object description' },
},
},
],
},
},
});
});

it('executes an introspection query without calling global resolvers', () => {
const schema = buildSchema(`
type Query {
Expand Down
2 changes: 0 additions & 2 deletions src/type/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({
description: {
type: GraphQLString,
resolve: (type) =>
// FIXME: add test case
/* node:coverage ignore next */
'description' in type ? type.description : undefined,
},
specifiedByURL: {
Expand Down