@@ -2070,25 +2070,34 @@ scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
2070
2070
2071
2071
## Schema Coordinates
2072
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
2073
SchemaCoordinate :
2077
2074
- Name
2078
2075
- Name . Name
2079
2076
- Name . Name ( Name : )
2080
2077
- @ Name
2081
2078
- @ Name ( Name : )
2082
2079
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 .
2080
+ :: A *schema coordinate * is a human readable string that uniquely identifies a
2081
+ *schema element * within a GraphQL Schema .
2082
+
2083
+ :: A *schema element * is a specific instance of a named type , type field ,
2084
+ input field , enum value , field argument , directive , or directive argument .
2085
+
2086
+ *Schema coordinate *s are always unique . Each *schema element * may be referenced
2087
+ by exactly one possible schema coordinate .
2088
+
2089
+ A *schema coordinate * may refer to both defined and built -in *schema element *s .
2090
+ For example , `String ` and `@deprecated (reason :)` are both valid schema coordinates .
2091
+
2092
+ Note : A {SchemaCoordinate } is not a definition within a GraphQL {Document }, but
2093
+ a separate stand -alone grammar , intended to be used by tools to reference types ,
2094
+ fields , and other *schema element *s . For example as references within
2095
+ documentation , or as lookup keys in usage frequency tracking .
2087
2096
2088
2097
**Semantics **
2089
2098
2090
- A schema coordinate ' s semantics assume they are interpreted in the context of
2091
- a single GraphQL {schema }.
2099
+ To refer to a * schema element *, a * schema coordinate * must be interpreted in the
2100
+ context of a GraphQL {schema }.
2092
2101
2093
2102
SchemaCoordinate : Name
2094
2103
1. Let {typeName } be the value of the first {Name }.
@@ -2131,97 +2140,40 @@ SchemaCoordinate : @ Name ( Name : )
2131
2140
2132
2141
**Examples **
2133
2142
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
- }
2143
+ | Element Kind | *Schema Coordinate * | *Schema Element * |
2144
+ | ------------------ | -------------------------------- | ----------------------------------------------------------------------- |
2145
+ | Named Type | `Business ` | `Business ` type |
2146
+ | Type Field | `Business .name ` | `name ` field on the `Business ` type |
2147
+ | Input Field | `SearchCriteria .filter ` | `filter ` input field on the `SearchCriteria ` input object type |
2148
+ | Enum Value | `SearchFilter .OPEN_NOW ` | `OPEN_NOW ` value of the `SearchFilter ` enum |
2149
+ | Field Argument | `Query .searchBusiness (criteria :)`| `criteria ` argument on the `searchBusiness ` field on the `Query ` type |
2150
+ | Directive | `@private ` | `@private ` directive |
2151
+ | Directive Argument | `@private (scope :)` | `scope ` argument on the `@private ` directive |
2153
2152
2154
- type User implements Address {
2155
- name : String
2156
- reviewCount : Int
2157
- friends : [User ]
2158
- email : String @private (scope : " loggedIn" )
2159
- city : String
2160
- }
2153
+ The table above shows an example of a *schema coordinate * for every kind of
2154
+ *schema element * based on the schema below .
2161
2155
2162
- type Business implements Address {
2163
- name : String
2164
- address : String
2165
- rating : Int
2166
- city : String
2167
- reviews : [Review ]
2168
- createdAt : DateTime
2156
+ ```graphql
2157
+ type Query {
2158
+ searchBusiness (criteria : SearchCriteria !): [Business ]
2169
2159
}
2170
2160
2171
- type Review {
2172
- content : String
2173
- author : User
2174
- business : Business
2175
- createdAt : DateTime
2161
+ input SearchCriteria {
2162
+ name : String
2163
+ filter : SearchFilter
2176
2164
}
2177
2165
2178
- union Entity = User | Business | Review
2179
-
2180
2166
enum SearchFilter {
2181
- OPEN_NOW
2182
- DELIVERS_TAKEOUT
2183
- VEGETARIAN_MENU
2184
- }
2185
-
2186
- type Query {
2187
- searchBusiness (name : String !, filter : SearchFilter ): Business
2167
+ OPEN_NOW
2168
+ DELIVERS_TAKEOUT
2169
+ VEGETARIAN_MENU
2188
2170
}
2189
2171
2190
- type Mutation {
2191
- addReview (input : ReviewInput !): Review
2172
+ type Business {
2173
+ id : ID
2174
+ name : String
2175
+ email : String @private (scope : " loggedIn" )
2192
2176
}
2193
- ```
2194
2177
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
2178
+ directive @private (scope : String !) on FIELD
2222
2179
```
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