From 7086160eb3eca1c0e23fe2a0cacd92d8c946b1e0 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Thu, 7 Sep 2017 16:40:39 +0300 Subject: [PATCH] Fix issues uncovered by enabling Flow --- src/validation/rules/KnownArgumentNames.js | 5 ++--- src/validation/rules/PossibleFragmentSpreads.js | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/validation/rules/KnownArgumentNames.js b/src/validation/rules/KnownArgumentNames.js index 9a2f99e4bd..dcf10e7faf 100644 --- a/src/validation/rules/KnownArgumentNames.js +++ b/src/validation/rules/KnownArgumentNames.js @@ -15,17 +15,16 @@ import invariant from '../../jsutils/invariant'; import suggestionList from '../../jsutils/suggestionList'; import quotedOrList from '../../jsutils/quotedOrList'; import * as Kind from '../../language/kinds'; -import type { GraphQLType } from '../../type/definition'; export function unknownArgMessage( argName: string, fieldName: string, - type: GraphQLType, + typeName: string, suggestedArgs: Array ): string { let message = `Unknown argument "${argName}" on field "${fieldName}" of ` + - `type "${String(type)}".`; + `type "${typeName}".`; if (suggestedArgs.length) { message += ` Did you mean ${quotedOrList(suggestedArgs)}?`; } diff --git a/src/validation/rules/PossibleFragmentSpreads.js b/src/validation/rules/PossibleFragmentSpreads.js index a0d66ac42b..b55df025e4 100644 --- a/src/validation/rules/PossibleFragmentSpreads.js +++ b/src/validation/rules/PossibleFragmentSpreads.js @@ -12,6 +12,7 @@ import type { ValidationContext } from '../index'; import { GraphQLError } from '../../error'; import { doTypesOverlap } from '../../utilities/typeComparators'; import { typeFromAST } from '../../utilities/typeFromAST'; +import { isCompositeType } from '../../type/definition'; import type { GraphQLType } from '../../type/definition'; @@ -44,8 +45,8 @@ export function PossibleFragmentSpreads(context: ValidationContext): any { InlineFragment(node) { const fragType = context.getType(); const parentType = context.getParentType(); - if (fragType && - parentType && + if (isCompositeType(fragType) && + isCompositeType(parentType) && !doTypesOverlap(context.getSchema(), fragType, parentType)) { context.reportError(new GraphQLError( typeIncompatibleAnonSpreadMessage(parentType, fragType),