@@ -282,163 +282,6 @@ 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 a specific
288
- type , field , argument , enum value , or directive defined in a GraphQL Schema.
289
-
290
- SchemaCoordinate :
291
- - Name
292
- - Name . Name
293
- - Name . Name ( Name : )
294
- - @ Name
295
- - @ Name ( Name : )
296
-
297
- Note: A {SchemaCoordinate } is not a definition within a GraphQL {Document }.
298
- Schema coordinates are a separate syntax , intended to be used by tools to
299
- reference types and fields or other schema elements. For example: within
300
- documentation, or as lookup keys a service uses to track usage frequency.
301
-
302
- **Semantics**
303
-
304
- A schema coordinate's semantics assume they are interpreted in the context of
305
- a single GraphQL {schema}.
306
-
307
- SchemaCoordinate : Name
308
- 1. Let {typeName } be the value of the first {Name }.
309
- 2. Return the type in the {schema } named {typeName }.
310
-
311
- SchemaCoordinate : Name . Name
312
- 1. Let {typeName } be the value of the first {Name }.
313
- 2. Let {type } be the type in the {schema } named {typeName }.
314
- 3. If {type } is an Enum type :
315
- 1. Let {enumValueName } be the value of the second {Name }.
316
- 2. Return the enum value of {type } named {enumValueName }.
317
- 4. Otherwise if {type } is an Input Object type :
318
- 1. Let {inputFieldName } be the value of the second {Name }.
319
- 2. Return the input field of {type } named {inputFieldName }.
320
- 5. Otherwise :
321
- 1. Assert {type } must be an Object or Interface type .
322
- 2. Let {fieldName } be the value of the second {Name }.
323
- 3. Return the field of {type } named {fieldName }.
324
-
325
- SchemaCoordinate : Name . Name ( Name : )
326
- 1. Let {typeName } be the value of the first {Name }.
327
- 2. Let {type } be the type in the {schema } named {typeName }.
328
- 3. Assert {type } must be an Object or Interface type .
329
- 4. Let {fieldName } be the value of the second {Name }.
330
- 5. Let {field } be the field of {type } named {fieldName }.
331
- 6. Assert {field } must exist .
332
- 7. Let {argumentName } be the value of the third {Name }.
333
- 8. Return the argument of {field } named {argumentName }.
334
-
335
- SchemaCoordinate : @ Name
336
- 1. Let {directiveName } be the value of the first {Name }.
337
- 2. Return the directive in the {schema } named {directiveName }.
338
-
339
- SchemaCoordinate : @ Name ( Name : )
340
- 1. Let {directiveName } be the value of the first {Name }.
341
- 2. Let {directive } be the directive in the {schema } named {directiveName }.
342
- 3. Assert {directive } must exist .
343
- 7. Let {argumentName } be the value of the second {Name }.
344
- 8. Return the argument of {directive } named {argumentName }.
345
-
346
- **Examples **
347
-
348
- This section shows example coordinates for the possible schema element types
349
- this syntax covers.
350
-
351
- All examples below will assume the following schema:
352
-
353
- ```graphql example
354
- directive @private (scope : String !) on FIELD
355
-
356
- scalar DateTime
357
-
358
- input ReviewInput {
359
- content : String
360
- author : String
361
- businessId : String
362
- }
363
-
364
- interface Address {
365
- city : String
366
- }
367
-
368
- type User implements Address {
369
- name : String
370
- reviewCount : Int
371
- friends : [User ]
372
- email : String @private (scope : " loggedIn" )
373
- city : String
374
- }
375
-
376
- type Business implements Address {
377
- name : String
378
- address : String
379
- rating : Int
380
- city : String
381
- reviews : [Review ]
382
- createdAt : DateTime
383
- }
384
-
385
- type Review {
386
- content : String
387
- author : User
388
- business : Business
389
- createdAt : DateTime
390
- }
391
-
392
- union Entity = User | Business | Review
393
-
394
- enum SearchFilter {
395
- OPEN_NOW
396
- DELIVERS_TAKEOUT
397
- VEGETARIAN_MENU
398
- }
399
-
400
- type Query {
401
- searchBusiness (name : String ! , filter : SearchFilter ): Business
402
- }
403
-
404
- type Mutation {
405
- addReview (input : ReviewInput ! ): Review
406
- }
407
- ```
408
-
409
- The following table shows examples of Schema Coordinates for elements in the
410
- schema above:
411
-
412
- | Schema Coordinate | Description |
413
- | ------------------------------ | ------------------------------------------------------------------- |
414
- | `Business` | `Business` type |
415
- | `User.name` | `name` field on the `User` type |
416
- | `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
417
- | `SearchFilter` | `SearchFilter` enum |
418
- | `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
419
- | `@private ` | `@private ` directive definition |
420
- | `@private (scope :)` | `scope` argument on the `@private ` directive definition |
421
- | `Address` | `Address` interface |
422
- | `Address.city` | `city` field on the `Address` interface |
423
- | `ReviewInput` | `ReviewInput` input object type |
424
- | `ReviewInput.author` | `author` input field on the `ReviewInput` input object type |
425
- | `Entity` | `Entity` union definition |
426
- | `DateTime` | Custom `DateTime` scalar type |
427
- | `String` | Built-in `String` scalar type |
428
-
429
- Schema Coordinates are always unique. Each type, field, argument, enum value, or
430
- directive may be referenced by exactly one possible Schema Coordinate.
431
-
432
- For example, the following is *not* a valid Schema Coordinate:
433
-
434
- ```graphql counter-example
435
- Entity.Business
436
- ```
437
-
438
- In this counter example, `Entity.Business` is redundant since `Business` already
439
- uniquely identifies the Business type. Such redundancy is disallowed by this
440
- spec - every type, field, field argument, enum value, directive, and directive
441
- argument has exactly one canonical Schema Coordinate.
442
285
443
286
## Types
444
287
@@ -2322,3 +2165,161 @@ to the relevant IETF specification.
2322
2165
```graphql example
2323
2166
scalar UUID @specifiedBy (url : " https://tools.ietf.org/html/rfc4122" )
2324
2167
```
2168
+
2169
+ ## Schema Coordinates
2170
+
2171
+ Schema Coordinates are human readable strings that uniquely identify a specific
2172
+ type , field , argument , enum value , or directive defined in a GraphQL Schema .
2173
+
2174
+ SchemaCoordinate :
2175
+ - Name
2176
+ - Name . Name
2177
+ - Name . Name ( Name : )
2178
+ - @ Name
2179
+ - @ Name ( Name : )
2180
+
2181
+ Note : A {SchemaCoordinate } is not a definition within a GraphQL {Document }.
2182
+ Schema coordinates are a separate syntax , intended to be used by tools to
2183
+ reference types and fields or other schema elements . For example : within
2184
+ documentation , or as lookup keys a service uses to track usage frequency .
2185
+
2186
+ **Semantics **
2187
+
2188
+ A schema coordinate 's semantics assume they are interpreted in the context of
2189
+ a single GraphQL {schema }.
2190
+
2191
+ SchemaCoordinate : Name
2192
+ 1. Let {typeName } be the value of the first {Name }.
2193
+ 2. Return the type in the {schema } named {typeName }.
2194
+
2195
+ SchemaCoordinate : Name . Name
2196
+ 1. Let {typeName } be the value of the first {Name }.
2197
+ 2. Let {type } be the type in the {schema } named {typeName }.
2198
+ 3. If {type } is an Enum type :
2199
+ 1. Let {enumValueName } be the value of the second {Name }.
2200
+ 2. Return the enum value of {type } named {enumValueName }.
2201
+ 4. Otherwise if {type } is an Input Object type :
2202
+ 1. Let {inputFieldName } be the value of the second {Name }.
2203
+ 2. Return the input field of {type } named {inputFieldName }.
2204
+ 5. Otherwise :
2205
+ 1. Assert {type } must be an Object or Interface type .
2206
+ 2. Let {fieldName } be the value of the second {Name }.
2207
+ 3. Return the field of {type } named {fieldName }.
2208
+
2209
+ SchemaCoordinate : Name . Name ( Name : )
2210
+ 1. Let {typeName } be the value of the first {Name }.
2211
+ 2. Let {type } be the type in the {schema } named {typeName }.
2212
+ 3. Assert {type } must be an Object or Interface type .
2213
+ 4. Let {fieldName } be the value of the second {Name }.
2214
+ 5. Let {field } be the field of {type } named {fieldName }.
2215
+ 6. Assert {field } must exist .
2216
+ 7. Let {argumentName } be the value of the third {Name }.
2217
+ 8. Return the argument of {field } named {argumentName }.
2218
+
2219
+ SchemaCoordinate : @ Name
2220
+ 1. Let {directiveName } be the value of the first {Name }.
2221
+ 2. Return the directive in the {schema } named {directiveName }.
2222
+
2223
+ SchemaCoordinate : @ Name ( Name : )
2224
+ 1. Let {directiveName } be the value of the first {Name }.
2225
+ 2. Let {directive } be the directive in the {schema } named {directiveName }.
2226
+ 3. Assert {directive } must exist .
2227
+ 7. Let {argumentName } be the value of the second {Name }.
2228
+ 8. Return the argument of {directive } named {argumentName }.
2229
+
2230
+ **Examples **
2231
+
2232
+ This section shows example coordinates for the possible schema element types
2233
+ this syntax covers .
2234
+
2235
+ All examples below will assume the following schema :
2236
+
2237
+ ```graphql example
2238
+ directive @private (scope : String !) on FIELD
2239
+
2240
+ scalar DateTime
2241
+
2242
+ input ReviewInput {
2243
+ content : String
2244
+ author : String
2245
+ businessId : String
2246
+ }
2247
+
2248
+ interface Address {
2249
+ city : String
2250
+ }
2251
+
2252
+ type User implements Address {
2253
+ name : String
2254
+ reviewCount : Int
2255
+ friends : [User ]
2256
+ email : String @private (scope : " loggedIn" )
2257
+ city : String
2258
+ }
2259
+
2260
+ type Business implements Address {
2261
+ name : String
2262
+ address : String
2263
+ rating : Int
2264
+ city : String
2265
+ reviews : [Review ]
2266
+ createdAt : DateTime
2267
+ }
2268
+
2269
+ type Review {
2270
+ content : String
2271
+ author : User
2272
+ business : Business
2273
+ createdAt : DateTime
2274
+ }
2275
+
2276
+ union Entity = User | Business | Review
2277
+
2278
+ enum SearchFilter {
2279
+ OPEN_NOW
2280
+ DELIVERS_TAKEOUT
2281
+ VEGETARIAN_MENU
2282
+ }
2283
+
2284
+ type Query {
2285
+ searchBusiness (name : String !, filter : SearchFilter ): Business
2286
+ }
2287
+
2288
+ type Mutation {
2289
+ addReview (input : ReviewInput !): Review
2290
+ }
2291
+ ```
2292
+
2293
+ The following table shows examples of Schema Coordinates for elements in the
2294
+ schema above :
2295
+
2296
+ | Schema Coordinate | Description |
2297
+ | ------------------------------ | ------------------------------------------------------------------- |
2298
+ | `Business ` | `Business ` type |
2299
+ | `User .name ` | `name ` field on the `User ` type |
2300
+ | `Query .searchBusiness (name :)` | `name ` argument on the `searchBusiness ` field on the `Query ` type |
2301
+ | `SearchFilter ` | `SearchFilter ` enum |
2302
+ | `SearchFilter .OPEN_NOW ` | `OPEN_NOW ` value of the `SearchFilter ` enum |
2303
+ | `@private ` | `@private ` directive definition |
2304
+ | `@private (scope :)` | `scope ` argument on the `@private ` directive definition |
2305
+ | `Address ` | `Address ` interface |
2306
+ | `Address .city ` | `city ` field on the `Address ` interface |
2307
+ | `ReviewInput ` | `ReviewInput ` input object type |
2308
+ | `ReviewInput .author ` | `author ` input field on the `ReviewInput ` input object type |
2309
+ | `Entity ` | `Entity ` union definition |
2310
+ | `DateTime ` | Custom `DateTime ` scalar type |
2311
+ | `String ` | Built -in `String ` scalar type |
2312
+
2313
+ Schema Coordinates are always unique . Each type , field , argument , enum value , or
2314
+ directive may be referenced by exactly one possible Schema Coordinate .
2315
+
2316
+ For example , the following is *not * a valid Schema Coordinate :
2317
+
2318
+ ```graphql counter -example
2319
+ Entity .Business
2320
+ ```
2321
+
2322
+ In this counter example , `Entity .Business ` is redundant since `Business ` already
2323
+ uniquely identifies the Business type . Such redundancy is disallowed by this
2324
+ spec - every type , field , field argument , enum value , directive , and directive
2325
+ argument has exactly one canonical Schema Coordinate .
0 commit comments