Skip to content

Commit 88b8098

Browse files
authored
Merge pull request #697 from graphql/is-leaf
Fix: isLeafType matches type definition.
2 parents bd15d53 + 12b2137 commit 88b8098

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/type/definition.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,9 @@ export type GraphQLLeafType =
135135
GraphQLEnumType;
136136

137137
export function isLeafType(type: ?GraphQLType): boolean {
138-
const namedType = getNamedType(type);
139138
return (
140-
namedType instanceof GraphQLScalarType ||
141-
namedType instanceof GraphQLEnumType
139+
type instanceof GraphQLScalarType ||
140+
type instanceof GraphQLEnumType
142141
);
143142
}
144143

src/validation/rules/ScalarLeafs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import type { ValidationContext } from '../index';
1212
import { GraphQLError } from '../../error';
1313
import type { FieldNode } from '../../language/ast';
14-
import { isLeafType } from '../../type/definition';
14+
import { getNamedType, isLeafType } from '../../type/definition';
1515
import type { GraphQLType } from '../../type/definition';
1616

1717

@@ -42,7 +42,7 @@ export function ScalarLeafs(context: ValidationContext): any {
4242
Field(node: FieldNode) {
4343
const type = context.getType();
4444
if (type) {
45-
if (isLeafType(type)) {
45+
if (isLeafType(getNamedType(type))) {
4646
if (node.selectionSet) {
4747
context.reportError(new GraphQLError(
4848
noSubselectionAllowedMessage(node.name.value, type),

0 commit comments

Comments
 (0)