Minimum requirements
Package | Minimum version |
---|---|
controlplane | 0.58.0 |
router | 0.60.0 |
wgc | 0.39.0 |
Definition
Arguments
Argument Name | Argument Type |
---|---|
scopes | [[openfed__Scope!]!]! |
Declaration
OR Scopes
Consider the following @requiresScopes declared on Query.fieldOne:AND Scopes
Consider the following @requiresScopes declared on Query.fieldTwoCombining OR and AND Scopes
Consider the following @requiresScopes declared on Query.fieldThreeDeclaration
The @requiresScopes directive can be declared on enums, field definitions, interfaces, objects, and scalars. However, there are some differences between declaration on leaf definitions and parent definitions.Declaration on leaf definitions (enums and scalars)
When @requiresScopes is declared on a leaf definition, the @requiresScopes directive (including its scopes) will be applied to all field definitions whose named type name (the innermost response type name) is the respective leaf definition within that subgraph. If the same leaf definition is defined in another subgraph without @requiresScopes, the corresponding field definitions unique to that that subgraph will be unaffected. But note that @requiresScopes could be applied to those field definitions through other means. If at least one instance of a shared field is declared with @requiresScopes, that field definition will be declared with @requiresScopes in the federated graph (see Federation). Consider the following example:- The enum “Enum”
- The scalar “Scalar”
- Query.enumQuery (named type name is “Enum”)
- Query.scalarQuery (named type name is “Scalar”)
- Object.enumField (named type name is “Enum”)
- Object.scalarField (named type name is “Scalar”)
Declaration on object definitions
When @requiresScopes is declared on an object definition, the @requiresScopes directive (including its scopes) will be applied to all field definitions defined on the object definition within that subgraph. If the same object definition is defined in another subgraph without @requiresScopes, the corresponding field definitions unique to that that subgraph will be unaffected. But note that @requiresScopes could be applied to those field definitions through other means. If at least one instance of a shared field is declared with @requiresScopes, that field definition will be declared with @requiresScopes in the federated graph (see Federation). Consider the following example:- The root object “Query”
- The object “Object”
- Query.objectQuery
- Query.objectsQuery
- Object.intField
- Object.stringField
Declaration on interface definitions
When @requiresScopes is declared on an interface definition, the @requiresScopes directive (including its scopes) will be applied to all field definitions defined on the interface definition within that subgraph. If the same interface definition is defined in another subgraph without @authenticated, the corresponding field definitions unique to that subgraph be unaffected. But note that @requiresScopes could be applied to those field definitions through other means. In addition, @requiresScopes will be applied to the corresponding field definitions defined on the objects that implement that interface within that subgraph. If at least one instance of a shared field is declared with @requiresScopes, that field definition will be declared with @requiresScopes in the federated graph (see Federation). Consider the following example:- Object
- AnotherObject
- Interface.intField
- Interface.stringField