Skip to content

Commit 4f854af

Browse files
committed
Move section
1 parent 4ca1b15 commit 4f854af

File tree

2 files changed

+165
-165
lines changed

2 files changed

+165
-165
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 & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -251,164 +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.
411-
412254
## Types
413255

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

0 commit comments

Comments
 (0)