@@ -253,7 +253,8 @@ Schema extensions have the potential to be invalid if incorrectly defined.
253
253
254
254
### Schema Coordinates
255
255
256
- Schema Coordinates are human readable strings that uniquely identify an element defined in a GraphQL Schema.
256
+ Schema Coordinates are human readable strings that uniquely identify a specific
257
+ type, field, argument, enum value, or directive defined in a GraphQL Schema.
257
258
258
259
** Definition**
259
260
@@ -264,6 +265,12 @@ SchemaCoordinate:
264
265
- @ Name
265
266
- @ Name ( Name : )
266
267
268
+ Note: The ` SchemaCoordinate ` syntax is not part of a GraphQL Document. Schema
269
+ Coordinates are a separate syntax, intended to be used by tooling when
270
+ referencing types and fields or other schema elements. (For example, a server
271
+ that wishes to keep track of the number of times fields have been accessed may
272
+ use their Schema Coordinate as the lookup key.)
273
+
267
274
** Semantics**
268
275
269
276
SchemaCoordinate: Name
@@ -307,7 +314,8 @@ SchemaCoordinate: @ Name ( Name : )
307
314
308
315
** Examples**
309
316
310
- This section shows example coordinates for the possible schema element types this syntax covers.
317
+ This section shows example coordinates for the possible schema element types
318
+ this syntax covers.
311
319
312
320
All examples below will assume the following schema:
313
321
@@ -367,16 +375,14 @@ type Mutation {
367
375
}
368
376
```
369
377
370
- The following table demonstrates how to select various kinds of schema members:
378
+ The following table shows examples of Schema Coordinates for elements in the
379
+ schema above:
371
380
372
381
| Schema Coordinate | Description |
373
382
| ------------------------------ | ------------------------------------------------------------------- |
374
383
| `Business` | `Business` type |
375
- | `User` | `User` type |
376
- | `Business.name` | `name` field on the `Business` type |
377
384
| `User.name` | `name` field on the `User` type |
378
385
| `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
379
- | `Query.searchBusiness(filter:)`| `filter` argument on the `searchBusiness` field on the `Query` type |
380
386
| `SearchFilter` | `SearchFilter` enum |
381
387
| `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
382
388
| `@private ` | `@private ` directive definition |
@@ -389,15 +395,19 @@ The following table demonstrates how to select various kinds of schema members:
389
395
| `DateTime` | Custom `DateTime` scalar type |
390
396
| `String` | Built-in `String` scalar type |
391
397
392
- Note: You may not select members inside a union definition.
398
+ Schema Coordinates are always unique. Each type, field, argument, enum value, or
399
+ directive may be referenced by exactly one possible Schema Coordinate.
393
400
394
- The following counter example is *not* considered a valid Schema Coordinate:
401
+ For example, the following is *not* a valid Schema Coordinate:
395
402
396
403
```graphql counter-example
397
404
Entity.Business
398
405
```
399
406
400
- In such cases, you may wish to select the type directly instead (e.g. `Business`).
407
+ In this counter example, both `Entity.Business` and `Business` would refer to
408
+ the `Business` type. Since it would be ambiguous what the "primary key" should
409
+ be in an application that uses Schema Coordinates to reference types, this is
410
+ not allowed.
401
411
402
412
## Types
403
413
0 commit comments