@@ -284,7 +284,8 @@ Schema extensions have the potential to be invalid if incorrectly defined.
284
284
285
285
### Schema Coordinates
286
286
287
- Schema Coordinates are human readable strings that uniquely identify an element defined in a GraphQL Schema .
287
+ Schema Coordinates are human readable strings that uniquely identify a specific
288
+ type , field , argument , enum value , or directive defined in a GraphQL Schema.
288
289
289
290
**Definition**
290
291
@@ -295,6 +296,12 @@ SchemaCoordinate:
295
296
- @ Name
296
297
- @ Name ( Name : )
297
298
299
+ Note: The `SchemaCoordinate` syntax is not part of a GraphQL Document. Schema
300
+ Coordinates are a separate syntax, intended to be used by tooling when
301
+ referencing types and fields or other schema elements. (For example, a server
302
+ that wishes to keep track of the number of times fields have been accessed may
303
+ use their Schema Coordinate as the lookup key.)
304
+
298
305
**Semantics**
299
306
300
307
SchemaCoordinate: Name
@@ -338,7 +345,8 @@ SchemaCoordinate: @ Name ( Name : )
338
345
339
346
**Examples **
340
347
341
- This section shows example coordinates for the possible schema element types this syntax covers.
348
+ This section shows example coordinates for the possible schema element types
349
+ this syntax covers.
342
350
343
351
All examples below will assume the following schema:
344
352
@@ -398,16 +406,14 @@ type Mutation {
398
406
}
399
407
```
400
408
401
- The following table demonstrates how to select various kinds of schema members:
409
+ The following table shows examples of Schema Coordinates for elements in the
410
+ schema above:
402
411
403
412
| Schema Coordinate | Description |
404
413
| ------------------------------ | ------------------------------------------------------------------- |
405
414
| `Business` | `Business` type |
406
- | `User` | `User` type |
407
- | `Business.name` | `name` field on the `Business` type |
408
415
| `User.name` | `name` field on the `User` type |
409
416
| `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
410
- | `Query.searchBusiness(filter:)`| `filter` argument on the `searchBusiness` field on the `Query` type |
411
417
| `SearchFilter` | `SearchFilter` enum |
412
418
| `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
413
419
| `@private ` | `@private ` directive definition |
@@ -420,15 +426,19 @@ The following table demonstrates how to select various kinds of schema members:
420
426
| `DateTime` | Custom `DateTime` scalar type |
421
427
| `String` | Built-in `String` scalar type |
422
428
423
- Note: You may not select members inside a union definition.
429
+ Schema Coordinates are always unique. Each type, field, argument, enum value, or
430
+ directive may be referenced by exactly one possible Schema Coordinate.
424
431
425
- The following counter example is *not* considered a valid Schema Coordinate:
432
+ For example, the following is *not* a valid Schema Coordinate:
426
433
427
434
```graphql counter-example
428
435
Entity.Business
429
436
```
430
437
431
- In such cases, you may wish to select the type directly instead (e.g. `Business`).
438
+ In this counter example, both `Entity.Business` and `Business` would refer to
439
+ the `Business` type. Since it would be ambiguous what the "primary key" should
440
+ be in an application that uses Schema Coordinates to reference types, this is
441
+ not allowed.
432
442
433
443
## Types
434
444
0 commit comments