@@ -188,18 +188,32 @@ ERROR
188
188
- Let {types } be the set of built -in types (for example, `FieldSelectionMap`)
189
189
defined by the composition specification from the schema .
190
190
- For each {type} in {types }:
191
- - {type } must strictly equal the built -in type defined by the composition
192
- specification .
191
+ - Let {kind } be the kind of {type }.
192
+ - {kind } must be equal to the kind defined by the composition specification .
193
+ - If {type } is a directive :
194
+ - Let {expectedArguments } be the set of arguments defined by the composition
195
+ specification .
196
+ - For each {expectedArgument } in {expectedArguments }:
197
+ - Let {name } be the name of {expectedArgument }.
198
+ - Let {argument } be the argument with {name } in {type }.
199
+ - {argument } must be defined .
200
+ - Let {expectedType } be the type of {expectedArgument}.
201
+ - Let {type } be the type of {argument}.
202
+ - {type } must be equal to {expectedType }.
193
203
194
204
**Explanatory Text **
195
205
196
- Certain types are reserved in composite schema specification for specific
197
- purposes and must adhere to the specification's definitions. For example,
198
- `FieldSelectionMap` is a built-in scalar that represents a selection of fields
199
- as a string. Redefining these built-in types with a different kind (e.g., an
200
- input object, enum, union, or object type) is disallowed and makes the
206
+ Certain types (and directives) are reserved in composite schema specification
207
+ for specific purposes and must adhere to the specification's definitions. For
208
+ example, `FieldSelectionMap` is a built-in scalar that represents a selection of
209
+ fields as a string. Redefining these built-in types with a different kind (e.g.,
210
+ an input object, enum, union, or object type) is disallowed and makes the
201
211
composition invalid.
202
212
213
+ To ensure schema evolution and interoperability, directives may include
214
+ additional arguments, provided that all required arguments defined by the
215
+ specification are present.
216
+
203
217
This rule ensures that built-in types maintain their expected shapes and
204
218
semantics so the composed schema can correctly interpret them.
205
219
@@ -218,6 +232,24 @@ input FieldSelectionMap {
218
232
}
219
233
```
220
234
235
+ In the following example, the ` @key ` directive includes an additional argument,
236
+ ` futureArg ` , which is not part of the specification. This is valid and allows
237
+ the directive to evolve without breaking existing schemas.
238
+
239
+ ``` graphql example
240
+ directive @key (
241
+ fields : SelectionSet !
242
+ futureArg : String
243
+ ) repeatable on OBJECT | INTERFACE
244
+ ```
245
+
246
+ However , if the `@key ` directive is defined without the required `fields `
247
+ argument , as shown below , it results in a `TYPE_DEFINITION_INVALID ` error .
248
+
249
+ ```graphql counter -example
250
+ directive @key (futureArg : String ) repeatable on OBJECT | INTERFACE
251
+ ```
252
+
221
253
#### Query Root Type Inaccessible
222
254
223
255
**Error Code **
0 commit comments