Skip to content

Commit c0b82d5

Browse files
committed
Move section
1 parent 4ca1b15 commit c0b82d5

File tree

2 files changed

+165
-164
lines changed

2 files changed

+165
-164
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,6 @@ SchemaExtension :
235235

236236
RootOperationTypeDefinition : OperationType : NamedType
237237

238-
SchemaCoordinate :
239-
- Name
240-
- Name . Name
241-
- Name . Name ( Name : )
242-
- @ Name
243-
- @ Name ( Name : )
244-
245238
Description : StringValue
246239

247240
TypeDefinition :
@@ -359,3 +352,10 @@ TypeSystemDirectiveLocation : one of
359352
- `ENUM_VALUE`
360353
- `INPUT_OBJECT`
361354
- `INPUT_FIELD_DEFINITION`
355+
356+
SchemaCoordinate :
357+
- Name
358+
- Name . Name
359+
- Name . Name ( Name : )
360+
- @ Name
361+
- @ Name ( Name : )

spec/Section 3 -- Type System.md

Lines changed: 158 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -251,163 +251,6 @@ Schema extensions have the potential to be invalid if incorrectly defined.
251251
2. Any non-repeatable directives provided must not already apply to the
252252
original Schema.
253253

254-
### Schema Coordinates
255-
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.
258-
259-
SchemaCoordinate :
260-
- Name
261-
- Name . Name
262-
- Name . Name ( Name : )
263-
- @ Name
264-
- @ Name ( Name : )
265-
266-
Note: A {SchemaCoordinate} is not a definition within a GraphQL {Document}.
267-
Schema coordinates are a separate syntax, intended to be used by tools to
268-
reference types and fields or other schema elements. For example: within
269-
documentation, or as lookup keys a service uses to track usage frequency.
270-
271-
**Semantics**
272-
273-
A schema coordinate's semantics assume they are interpreted in the context of
274-
a single GraphQL {schema}.
275-
276-
SchemaCoordinate : Name
277-
1. Let {typeName} be the value of the first {Name}.
278-
2. Return the type in the {schema} named {typeName}.
279-
280-
SchemaCoordinate : Name . Name
281-
1. Let {typeName} be the value of the first {Name}.
282-
2. Let {type} be the type in the {schema} named {typeName}.
283-
3. If {type} is an Enum type:
284-
1. Let {enumValueName} be the value of the second {Name}.
285-
2. Return the enum value of {type} named {enumValueName}.
286-
4. Otherwise if {type} is an Input Object type:
287-
1. Let {inputFieldName} be the value of the second {Name}.
288-
2. Return the input field of {type} named {inputFieldName}.
289-
5. Otherwise:
290-
1. Assert {type} must be an Object or Interface type.
291-
2. Let {fieldName} be the value of the second {Name}.
292-
3. Return the field of {type} named {fieldName}.
293-
294-
SchemaCoordinate : Name . Name ( Name : )
295-
1. Let {typeName} be the value of the first {Name}.
296-
2. Let {type} be the type in the {schema} named {typeName}.
297-
3. Assert {type} must be an Object or Interface type.
298-
4. Let {fieldName} be the value of the second {Name}.
299-
5. Let {field} be the field of {type} named {fieldName}.
300-
6. Assert {field} must exist.
301-
7. Let {argumentName} be the value of the third {Name}.
302-
8. Return the argument of {field} named {argumentName}.
303-
304-
SchemaCoordinate : @ Name
305-
1. Let {directiveName} be the value of the first {Name}.
306-
2. Return the directive in the {schema} named {directiveName}.
307-
308-
SchemaCoordinate : @ Name ( Name : )
309-
1. Let {directiveName} be the value of the first {Name}.
310-
2. Let {directive} be the directive in the {schema} named {directiveName}.
311-
3. Assert {directive} must exist.
312-
7. Let {argumentName} be the value of the second {Name}.
313-
8. Return the argument of {directive} named {argumentName}.
314-
315-
**Examples**
316-
317-
This section shows example coordinates for the possible schema element types
318-
this syntax covers.
319-
320-
All examples below will assume the following schema:
321-
322-
```graphql example
323-
directive @private(scope: String!) on FIELD
324-
325-
scalar DateTime
326-
327-
input ReviewInput {
328-
content: String
329-
author: String
330-
businessId: String
331-
}
332-
333-
interface Address {
334-
city: String
335-
}
336-
337-
type User implements Address {
338-
name: String
339-
reviewCount: Int
340-
friends: [User]
341-
email: String @private(scope: "loggedIn")
342-
city: String
343-
}
344-
345-
type Business implements Address {
346-
name: String
347-
address: String
348-
rating: Int
349-
city: String
350-
reviews: [Review]
351-
createdAt: DateTime
352-
}
353-
354-
type Review {
355-
content: String
356-
author: User
357-
business: Business
358-
createdAt: DateTime
359-
}
360-
361-
union Entity = User | Business | Review
362-
363-
enum SearchFilter {
364-
OPEN_NOW
365-
DELIVERS_TAKEOUT
366-
VEGETARIAN_MENU
367-
}
368-
369-
type Query {
370-
searchBusiness(name: String!, filter: SearchFilter): Business
371-
}
372-
373-
type Mutation {
374-
addReview(input: ReviewInput!): Review
375-
}
376-
```
377-
378-
The following table shows examples of Schema Coordinates for elements in the
379-
schema above:
380-
381-
| Schema Coordinate | Description |
382-
| ------------------------------ | ------------------------------------------------------------------- |
383-
| `Business` | `Business` type |
384-
| `User.name` | `name` field on the `User` type |
385-
| `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
386-
| `SearchFilter` | `SearchFilter` enum |
387-
| `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
388-
| `@private` | `@private` directive definition |
389-
| `@private(scope:)` | `scope` argument on the `@private` directive definition |
390-
| `Address` | `Address` interface |
391-
| `Address.city` | `city` field on the `Address` interface |
392-
| `ReviewInput` | `ReviewInput` input object type |
393-
| `ReviewInput.author` | `author` input field on the `ReviewInput` input object type |
394-
| `Entity` | `Entity` union definition |
395-
| `DateTime` | Custom `DateTime` scalar type |
396-
| `String` | Built-in `String` scalar type |
397-
398-
Schema Coordinates are always unique. Each type, field, argument, enum value, or
399-
directive may be referenced by exactly one possible Schema Coordinate.
400-
401-
For example, the following is *not* a valid Schema Coordinate:
402-
403-
```graphql counter-example
404-
Entity.Business
405-
```
406-
407-
In this counter example, `Entity.Business` is redundant since `Business` already
408-
uniquely identifies the Business type. Such redundancy is disallowed by this
409-
spec - every type, field, field argument, enum value, directive, and directive
410-
argument has exactly one canonical Schema Coordinate.
411254

412255
## Types
413256

@@ -2224,3 +2067,161 @@ to the relevant IETF specification.
22242067
```graphql example
22252068
scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
22262069
```
2070+
2071+
## Schema Coordinates
2072+
2073+
Schema Coordinates are human readable strings that uniquely identify a specific
2074+
type, field, argument, enum value, or directive defined in a GraphQL Schema.
2075+
2076+
SchemaCoordinate :
2077+
- Name
2078+
- Name . Name
2079+
- Name . Name ( Name : )
2080+
- @ Name
2081+
- @ Name ( Name : )
2082+
2083+
Note: A {SchemaCoordinate} is not a definition within a GraphQL {Document}.
2084+
Schema coordinates are a separate syntax, intended to be used by tools to
2085+
reference types and fields or other schema elements. For example: within
2086+
documentation, or as lookup keys a service uses to track usage frequency.
2087+
2088+
**Semantics**
2089+
2090+
A schema coordinate's semantics assume they are interpreted in the context of
2091+
a single GraphQL {schema}.
2092+
2093+
SchemaCoordinate : Name
2094+
1. Let {typeName} be the value of the first {Name}.
2095+
2. Return the type in the {schema} named {typeName}.
2096+
2097+
SchemaCoordinate : Name . Name
2098+
1. Let {typeName} be the value of the first {Name}.
2099+
2. Let {type} be the type in the {schema} named {typeName}.
2100+
3. If {type} is an Enum type:
2101+
1. Let {enumValueName} be the value of the second {Name}.
2102+
2. Return the enum value of {type} named {enumValueName}.
2103+
4. Otherwise if {type} is an Input Object type:
2104+
1. Let {inputFieldName} be the value of the second {Name}.
2105+
2. Return the input field of {type} named {inputFieldName}.
2106+
5. Otherwise:
2107+
1. Assert {type} must be an Object or Interface type.
2108+
2. Let {fieldName} be the value of the second {Name}.
2109+
3. Return the field of {type} named {fieldName}.
2110+
2111+
SchemaCoordinate : Name . Name ( Name : )
2112+
1. Let {typeName} be the value of the first {Name}.
2113+
2. Let {type} be the type in the {schema} named {typeName}.
2114+
3. Assert {type} must be an Object or Interface type.
2115+
4. Let {fieldName} be the value of the second {Name}.
2116+
5. Let {field} be the field of {type} named {fieldName}.
2117+
6. Assert {field} must exist.
2118+
7. Let {argumentName} be the value of the third {Name}.
2119+
8. Return the argument of {field} named {argumentName}.
2120+
2121+
SchemaCoordinate : @ Name
2122+
1. Let {directiveName} be the value of the first {Name}.
2123+
2. Return the directive in the {schema} named {directiveName}.
2124+
2125+
SchemaCoordinate : @ Name ( Name : )
2126+
1. Let {directiveName} be the value of the first {Name}.
2127+
2. Let {directive} be the directive in the {schema} named {directiveName}.
2128+
3. Assert {directive} must exist.
2129+
7. Let {argumentName} be the value of the second {Name}.
2130+
8. Return the argument of {directive} named {argumentName}.
2131+
2132+
**Examples**
2133+
2134+
This section shows example coordinates for the possible schema element types
2135+
this syntax covers.
2136+
2137+
All examples below will assume the following schema:
2138+
2139+
```graphql example
2140+
directive @private(scope: String!) on FIELD
2141+
2142+
scalar DateTime
2143+
2144+
input ReviewInput {
2145+
content: String
2146+
author: String
2147+
businessId: String
2148+
}
2149+
2150+
interface Address {
2151+
city: String
2152+
}
2153+
2154+
type User implements Address {
2155+
name: String
2156+
reviewCount: Int
2157+
friends: [User]
2158+
email: String @private(scope: "loggedIn")
2159+
city: String
2160+
}
2161+
2162+
type Business implements Address {
2163+
name: String
2164+
address: String
2165+
rating: Int
2166+
city: String
2167+
reviews: [Review]
2168+
createdAt: DateTime
2169+
}
2170+
2171+
type Review {
2172+
content: String
2173+
author: User
2174+
business: Business
2175+
createdAt: DateTime
2176+
}
2177+
2178+
union Entity = User | Business | Review
2179+
2180+
enum SearchFilter {
2181+
OPEN_NOW
2182+
DELIVERS_TAKEOUT
2183+
VEGETARIAN_MENU
2184+
}
2185+
2186+
type Query {
2187+
searchBusiness(name: String!, filter: SearchFilter): Business
2188+
}
2189+
2190+
type Mutation {
2191+
addReview(input: ReviewInput!): Review
2192+
}
2193+
```
2194+
2195+
The following table shows examples of Schema Coordinates for elements in the
2196+
schema above:
2197+
2198+
| Schema Coordinate | Description |
2199+
| ------------------------------ | ------------------------------------------------------------------- |
2200+
| `Business` | `Business` type |
2201+
| `User.name` | `name` field on the `User` type |
2202+
| `Query.searchBusiness(name:)` | `name` argument on the `searchBusiness` field on the `Query` type |
2203+
| `SearchFilter` | `SearchFilter` enum |
2204+
| `SearchFilter.OPEN_NOW` | `OPEN_NOW` value of the`SearchFilter` enum |
2205+
| `@private` | `@private` directive definition |
2206+
| `@private(scope:)` | `scope` argument on the `@private` directive definition |
2207+
| `Address` | `Address` interface |
2208+
| `Address.city` | `city` field on the `Address` interface |
2209+
| `ReviewInput` | `ReviewInput` input object type |
2210+
| `ReviewInput.author` | `author` input field on the `ReviewInput` input object type |
2211+
| `Entity` | `Entity` union definition |
2212+
| `DateTime` | Custom `DateTime` scalar type |
2213+
| `String` | Built-in `String` scalar type |
2214+
2215+
Schema Coordinates are always unique. Each type, field, argument, enum value, or
2216+
directive may be referenced by exactly one possible Schema Coordinate.
2217+
2218+
For example, the following is *not* a valid Schema Coordinate:
2219+
2220+
```graphql counter-example
2221+
Entity.Business
2222+
```
2223+
2224+
In this counter example, `Entity.Business` is redundant since `Business` already
2225+
uniquely identifies the Business type. Such redundancy is disallowed by this
2226+
spec - every type, field, field argument, enum value, directive, and directive
2227+
argument has exactly one canonical Schema Coordinate.

0 commit comments

Comments
 (0)