Skip to content

Commit e606cec

Browse files
committed
Merge branch 'master' of github.com:graphql/graphql-js
2 parents e6051bc + 242fdcb commit e606cec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/validation/rules/KnownArgumentNames.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import type { ValidationContext } from '../index';
1212
import { GraphQLError } from '../../error';
1313
import find from '../../jsutils/find';
1414
import invariant from '../../jsutils/invariant';
15+
import {
16+
FIELD,
17+
DIRECTIVE
18+
} from '../../language/kinds';
1519

1620

1721
export function unknownArgMessage(
@@ -40,7 +44,7 @@ export function KnownArgumentNames(context: ValidationContext): any {
4044
return {
4145
Argument(node, key, parent, path, ancestors) {
4246
var argumentOf = ancestors[ancestors.length - 1];
43-
if (argumentOf.kind === 'Field') {
47+
if (argumentOf.kind === FIELD) {
4448
var fieldDef = context.getFieldDef();
4549
if (fieldDef) {
4650
var fieldArgDef = find(
@@ -60,7 +64,7 @@ export function KnownArgumentNames(context: ValidationContext): any {
6064
);
6165
}
6266
}
63-
} else if (argumentOf.kind === 'Directive') {
67+
} else if (argumentOf.kind === DIRECTIVE) {
6468
var directive = context.getDirective();
6569
if (directive) {
6670
var directiveArgDef = find(

src/validation/rules/LoneAnonymousOperation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
import { GraphQLError } from '../../error';
12+
import { OPERATION_DEFINITION } from '../../language/kinds';
1213

1314

1415
export function anonOperationNotAloneMessage(): string {
@@ -26,7 +27,7 @@ export function LoneAnonymousOperation(): any {
2627
return {
2728
Document(node) {
2829
operationCount = node.definitions.filter(
29-
definition => definition.kind === 'OperationDefinition'
30+
definition => definition.kind === OPERATION_DEFINITION
3031
).length;
3132
},
3233
OperationDefinition(node) {

0 commit comments

Comments
 (0)