Skip to content

Commit 0800c34

Browse files
committed
Follow up: clarify AST kind names
1 parent 7a07c81 commit 0800c34

File tree

9 files changed

+137
-135
lines changed

9 files changed

+137
-135
lines changed

src/execution/__tests__/executor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ describe('Execute: Handles basic execution tasks', () => {
671671
}
672672

673673
expect(caughtError).to.deep.equal({
674-
message: 'GraphQL cannot execute a request containing a ObjectDefinition.'
674+
message:
675+
'GraphQL cannot execute a request containing a ObjectTypeDefinition.'
675676
});
676677
});
677678

src/language/__tests__/schema-parser.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type Hello {
8686
kind: 'Document',
8787
definitions: [
8888
{
89-
kind: 'ObjectDefinition',
89+
kind: 'ObjectTypeDefinition',
9090
name: nameNode('Hello', loc(6, 11)),
9191
interfaces: [],
9292
fields: [
@@ -115,7 +115,7 @@ type Hello {
115115
kind: 'Document',
116116
definitions: [
117117
{
118-
kind: 'ObjectDefinition',
118+
kind: 'ObjectTypeDefinition',
119119
name: nameNode('Hello', loc(6, 11)),
120120
interfaces: [],
121121
fields: [
@@ -146,7 +146,7 @@ type Hello {
146146
kind: 'Document',
147147
definitions: [
148148
{
149-
kind: 'ObjectDefinition',
149+
kind: 'ObjectTypeDefinition',
150150
name: nameNode('Hello', loc(5, 10)),
151151
interfaces: [ typeNode('World', loc(22, 27)) ],
152152
fields: [],
@@ -166,7 +166,7 @@ type Hello {
166166
kind: 'Document',
167167
definitions: [
168168
{
169-
kind: 'ObjectDefinition',
169+
kind: 'ObjectTypeDefinition',
170170
name: nameNode('Hello', loc(5, 10)),
171171
interfaces: [
172172
typeNode('Wo', loc(22, 24)),
@@ -189,7 +189,7 @@ type Hello {
189189
kind: 'Document',
190190
definitions: [
191191
{
192-
kind: 'EnumDefinition',
192+
kind: 'EnumTypeDefinition',
193193
name: nameNode('Hello', loc(5, 10)),
194194
values: [ enumValueNode('WORLD', loc(13, 18)) ],
195195
loc: loc(0, 20),
@@ -208,7 +208,7 @@ type Hello {
208208
kind: 'Document',
209209
definitions: [
210210
{
211-
kind: 'EnumDefinition',
211+
kind: 'EnumTypeDefinition',
212212
name: nameNode('Hello', loc(5, 10)),
213213
values: [
214214
enumValueNode('WO', loc(13, 15)),
@@ -233,7 +233,7 @@ interface Hello {
233233
kind: 'Document',
234234
definitions: [
235235
{
236-
kind: 'InterfaceDefinition',
236+
kind: 'InterfaceTypeDefinition',
237237
name: nameNode('Hello', loc(11, 16)),
238238
fields: [
239239
fieldNode(
@@ -261,7 +261,7 @@ type Hello {
261261
kind: 'Document',
262262
definitions: [
263263
{
264-
kind: 'ObjectDefinition',
264+
kind: 'ObjectTypeDefinition',
265265
name: nameNode('Hello', loc(6, 11)),
266266
interfaces: [],
267267
fields: [
@@ -298,7 +298,7 @@ type Hello {
298298
kind: 'Document',
299299
definitions: [
300300
{
301-
kind: 'ObjectDefinition',
301+
kind: 'ObjectTypeDefinition',
302302
name: nameNode('Hello', loc(6, 11)),
303303
interfaces: [],
304304
fields: [
@@ -339,7 +339,7 @@ type Hello {
339339
kind: 'Document',
340340
definitions: [
341341
{
342-
kind: 'ObjectDefinition',
342+
kind: 'ObjectTypeDefinition',
343343
name: nameNode('Hello', loc(6, 11)),
344344
interfaces: [],
345345
fields: [
@@ -380,7 +380,7 @@ type Hello {
380380
kind: 'Document',
381381
definitions: [
382382
{
383-
kind: 'ObjectDefinition',
383+
kind: 'ObjectTypeDefinition',
384384
name: nameNode('Hello', loc(6, 11)),
385385
interfaces: [],
386386
fields: [
@@ -420,7 +420,7 @@ type Hello {
420420
kind: 'Document',
421421
definitions: [
422422
{
423-
kind: 'UnionDefinition',
423+
kind: 'UnionTypeDefinition',
424424
name: nameNode('Hello', loc(6, 11)),
425425
types: [ typeNode('World', loc(14, 19)) ],
426426
loc: loc(0, 19),
@@ -439,7 +439,7 @@ type Hello {
439439
kind: 'Document',
440440
definitions: [
441441
{
442-
kind: 'UnionDefinition',
442+
kind: 'UnionTypeDefinition',
443443
name: nameNode('Hello', loc(6, 11)),
444444
types: [
445445
typeNode('Wo', loc(14, 16)),
@@ -461,7 +461,7 @@ type Hello {
461461
kind: 'Document',
462462
definitions: [
463463
{
464-
kind: 'ScalarDefinition',
464+
kind: 'ScalarTypeDefinition',
465465
name: nameNode('Hello', loc(7, 12)),
466466
loc: loc(0, 12),
467467
}
@@ -482,7 +482,7 @@ input Hello {
482482
kind: 'Document',
483483
definitions: [
484484
{
485-
kind: 'InputObjectDefinition',
485+
kind: 'InputObjectTypeDefinition',
486486
name: nameNode('Hello', loc(7, 12)),
487487
fields: [
488488
inputValueNode(

src/language/__tests__/schema-printer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Printer', () => {
1818

1919
it('prints minimal ast', () => {
2020
var ast = {
21-
kind: 'ScalarDefinition',
21+
kind: 'ScalarTypeDefinition',
2222
name: { kind: 'Name', value: 'foo' }
2323
};
2424
expect(print(ast)).to.equal('scalar foo');

src/language/ast.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ export type Node = Name
4646
| Directive
4747
| ListType
4848
| NonNullType
49-
| ObjectDefinition
49+
| ObjectTypeDefinition
5050
| FieldDefinition
5151
| InputValueDefinition
52-
| InterfaceDefinition
53-
| UnionDefinition
54-
| ScalarDefinition
55-
| EnumDefinition
52+
| InterfaceTypeDefinition
53+
| UnionTypeDefinition
54+
| ScalarTypeDefinition
55+
| EnumTypeDefinition
5656
| EnumValueDefinition
57-
| InputObjectDefinition
57+
| InputObjectTypeDefinition
5858

5959
// Name
6060

@@ -253,15 +253,15 @@ export type NonNullType = {
253253
// Type Definition
254254

255255
export type TypeDefinition =
256-
ObjectDefinition |
257-
InterfaceDefinition |
258-
UnionDefinition |
259-
ScalarDefinition |
260-
EnumDefinition |
261-
InputObjectDefinition
256+
ObjectTypeDefinition |
257+
InterfaceTypeDefinition |
258+
UnionTypeDefinition |
259+
ScalarTypeDefinition |
260+
EnumTypeDefinition |
261+
InputObjectTypeDefinition
262262

263-
export type ObjectDefinition = {
264-
kind: 'ObjectDefinition';
263+
export type ObjectTypeDefinition = {
264+
kind: 'ObjectTypeDefinition';
265265
loc?: ?Location;
266266
name: Name;
267267
interfaces?: ?Array<NamedType>;
@@ -284,28 +284,28 @@ export type InputValueDefinition = {
284284
defaultValue?: ?Value;
285285
}
286286

287-
export type InterfaceDefinition = {
288-
kind: 'InterfaceDefinition';
287+
export type InterfaceTypeDefinition = {
288+
kind: 'InterfaceTypeDefinition';
289289
loc?: ?Location;
290290
name: Name;
291291
fields: Array<FieldDefinition>;
292292
}
293293

294-
export type UnionDefinition = {
295-
kind: 'UnionDefinition';
294+
export type UnionTypeDefinition = {
295+
kind: 'UnionTypeDefinition';
296296
loc?: ?Location;
297297
name: Name;
298298
types: Array<NamedType>;
299299
}
300300

301-
export type ScalarDefinition = {
302-
kind: 'ScalarDefinition';
301+
export type ScalarTypeDefinition = {
302+
kind: 'ScalarTypeDefinition';
303303
loc?: ?Location;
304304
name: Name;
305305
}
306306

307-
export type EnumDefinition = {
308-
kind: 'EnumDefinition';
307+
export type EnumTypeDefinition = {
308+
kind: 'EnumTypeDefinition';
309309
loc?: ?Location;
310310
name: Name;
311311
values: Array<EnumValueDefinition>;
@@ -317,8 +317,8 @@ export type EnumValueDefinition = {
317317
name: Name;
318318
}
319319

320-
export type InputObjectDefinition = {
321-
kind: 'InputObjectDefinition';
320+
export type InputObjectTypeDefinition = {
321+
kind: 'InputObjectTypeDefinition';
322322
loc?: ?Location;
323323
name: Name;
324324
fields: Array<InputValueDefinition>;

src/language/kinds.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ export const NON_NULL_TYPE = 'NonNullType';
5050

5151
// Type Definitions
5252

53-
export const OBJECT_DEFINITION = 'ObjectDefinition';
53+
export const OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition';
5454
export const FIELD_DEFINITION = 'FieldDefinition';
5555
export const INPUT_VALUE_DEFINITION = 'InputValueDefinition';
56-
export const INTERFACE_DEFINITION = 'InterfaceDefinition';
57-
export const UNION_DEFINITION = 'UnionDefinition';
58-
export const SCALAR_DEFINITION = 'ScalarDefinition';
59-
export const ENUM_DEFINITION = 'EnumDefinition';
56+
export const INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition';
57+
export const UNION_TYPE_DEFINITION = 'UnionTypeDefinition';
58+
export const SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition';
59+
export const ENUM_TYPE_DEFINITION = 'EnumTypeDefinition';
6060
export const ENUM_VALUE_DEFINITION = 'EnumValueDefinition';
61-
export const INPUT_OBJECT_DEFINITION = 'InputObjectDefinition';
61+
export const INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition';

0 commit comments

Comments
 (0)