@@ -282,6 +282,153 @@ Schema extensions have the potential to be invalid if incorrectly defined.
282
282
2. Any non -repeatable directives provided must not already apply to the original
283
283
Schema .
284
284
285
+ ### Schema Coordinates
286
+
287
+ Schema Coordinates are human readable strings that uniquely identify an element defined in a GraphQL Schema .
288
+
289
+ **Definition **
290
+
291
+ SchemaCoordinate :
292
+ - Name
293
+ - Name . Name
294
+ - Name . Name ( Name : )
295
+ - @ Name
296
+ - @ Name ( Name : )
297
+
298
+ **Semantics **
299
+
300
+ SchemaCoordinate : Name
301
+ 1. Let {typeName } be the value of the first {Name }.
302
+ 2. Return the type in the schema named {typeName}.
303
+
304
+ SchemaCoordinate : Name . Name
305
+ 1. Let {typeName } be the value of the first {Name }.
306
+ 2. Let {type } be the type in the schema named {typeName}.
307
+ 3. If {type } is an Enum type :
308
+ 1. Let {enumName } be the value of the second {Name }.
309
+ 2. Return the enum value of {type } named {enumName }.
310
+ 4. Otherwise if {type } is an Input Object type :
311
+ 1. Let {inputFieldName } be the value of the second {Name }.
312
+ 2. Return the input field of {type } named {inputFieldName }.
313
+ 5. Otherwise {type } must be an Object or Interface type :
314
+ 1. Let {fieldName } be the value of the second {Name }.
315
+ 2. Return the field of {type } named {fieldName }.
316
+
317
+ SchemaCoordinate : Name . Name ( Name : )
318
+ 1. Let {typeName } be the value of the first {Name }.
319
+ 2. Let {type } be the type in the schema named {typeName}.
320
+ 3. Assert : {type } must be an Object or Interface type .
321
+ 4. Let {fieldName } be the value of the second {Name }.
322
+ 5. Let {field } be the field of {type } named {fieldName }.
323
+ 6. Assert : {field } must exist .
324
+ 7. Let {argumentName } be the value of the third {Name }.
325
+ 8. Return the argument of {field } named {argumentName }.
326
+
327
+ SchemaCoordinate : @ Name
328
+ 1. Let {directiveName } be the value of the first {Name }.
329
+ 2. Return the directive in the schema named {directiveName}.
330
+
331
+ SchemaCoordinate : @ Name ( Name : )
332
+ 1. Let {directiveName } be the value of the first {Name }.
333
+ 2. Let {directive } be the directive in the schema named {directiveName}.
334
+ 3. Assert : {directive } must exist .
335
+ 7. Let {argumentName } be the value of the second {Name }.
336
+ 8. Return the argument of {directive } named {argumentName }
337
+
338
+ **Examples **
339
+
340
+ This section shows example coordinates for the possible schema element types this syntax covers.
341
+
342
+ All examples below will assume the following schema:
343
+
344
+ ```graphql example
345
+ directive @private (scope : String !) on FIELD
346
+
347
+ scalar DateTime
348
+
349
+ input ReviewInput {
350
+ content : String
351
+ author : String
352
+ businessId : String
353
+ }
354
+
355
+ interface Address {
356
+ city : String
357
+ }
358
+
359
+ type User implements Address {
360
+ name : String
361
+ reviewCount : Int
362
+ friends : [User ]
363
+ email : String @private (scope : " loggedIn" )
364
+ city : String
365
+ }
366
+
367
+ type Business implements Address {
368
+ name : String
369
+ address : String
370
+ rating : Int
371
+ city : String
372
+ reviews : [Review ]
373
+ createdAt : DateTime
374
+ }
375
+
376
+ type Review {
377
+ content : String
378
+ author : User
379
+ business : Business
380
+ createdAt : DateTime
381
+ }
382
+
383
+ union Entity = User | Business | Review
384
+
385
+ enum SearchFilter {
386
+ OPEN_NOW
387
+ DELIVERS_TAKEOUT
388
+ VEGETARIAN_MENU
389
+ }
390
+
391
+ type Query {
392
+ searchBusiness (name : String ! , filter : SearchFilter ): Business
393
+ }
394
+
395
+ type Mutation {
396
+ addReview (input : ReviewInput ! ): Review
397
+ }
398
+ ```
399
+
400
+ The following table demonstrates how to select various kinds of schema elements:
401
+
402
+ | Example | Description |
403
+ | ------------------------------ | ------------------------------------------------------------------- |
404
+ | `Business` | `Business` type |
405
+ | `User` | `User` type |
406
+ | `Business.name` | `name` field on the `Business` type |
407
+ | `User.name` | `name` field on the `User` type |
408
+ | `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
409
+ | `Query.searchBusiness(filter:)`| `filter` argument on the `searchBusiness` field on the `Query` type |
410
+ | `SearchFilter` | `SearchFilter` enum |
411
+ | `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
412
+ | `@private ` | `@private ` directive definition |
413
+ | `@private (scope :)` | `scope` argument on the `@private ` directive definition |
414
+ | `Address` | `Address` interface |
415
+ | `Address.city` | `city` field on the `Address` interface |
416
+ | `ReviewInput` | `ReviewInput` input object type |
417
+ | `ReviewInput.author` | `author` field on the `ReviewInput` input object type |
418
+ | `Entity` | `Entity` union definition |
419
+ | `DateTime` | Custom `DateTime` scalar type |
420
+ | `String` | Built-in `String` scalar type |
421
+
422
+ Note: You may not select members inside a union definition.
423
+
424
+ The following counter example is *not* considered a valid Schema Coordinate:
425
+
426
+ ```graphql counter-example
427
+ Entity.Business
428
+ ```
429
+
430
+ In such cases, you may wish to select the type directly instead (e.g. `Business`).
431
+
285
432
## Types
286
433
287
434
TypeDefinition :
0 commit comments