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