5
5
namespace Rebing \GraphQL \Support ;
6
6
7
7
use Closure ;
8
- use Validator ;
9
- use Illuminate \Support \Arr ;
10
- use GraphQL \Type \Definition \NonNull ;
8
+ use GraphQL \Type \Definition \InputObjectType ;
11
9
use GraphQL \Type \Definition \ListOfType ;
10
+ use GraphQL \Type \Definition \NonNull ;
12
11
use GraphQL \Type \Definition \ResolveInfo ;
12
+ use GraphQL \Type \Definition \Type as GraphqlType ;
13
13
use GraphQL \Type \Definition \WrappingType ;
14
- use Rebing \GraphQL \Error \ValidationError ;
15
- use GraphQL \Type \Definition \InputObjectType ;
14
+ use Illuminate \Support \Arr ;
16
15
use Rebing \GraphQL \Error \AuthorizationError ;
17
- use GraphQL \Type \Definition \Type as GraphqlType ;
16
+ use Rebing \GraphQL \Error \ValidationError ;
17
+ use Validator ;
18
18
19
19
abstract class Field
20
20
{
@@ -118,7 +118,7 @@ public function inferRulesFromType(GraphqlType $type, string $prefix, array $res
118
118
119
119
// make sure we are dealing with the actual type
120
120
if ($ type instanceof WrappingType) {
121
- $ type = $ type ->getWrappedType ();
121
+ $ type = $ type ->getWrappedType (true );
122
122
}
123
123
124
124
// if it is an input object type - the only type we care about here...
@@ -144,12 +144,17 @@ public function getInputTypeRules(InputObjectType $input, string $prefix, array
144
144
$ rules [$ key ] = $ this ->resolveRules ($ field ->rules , $ resolutionArguments );
145
145
}
146
146
147
+ $ type = $ field ->type ;
148
+ if ($ field ->type instanceof WrappingType) {
149
+ $ type = $ field ->type ->getWrappedType (true );
150
+ }
151
+
147
152
// then recursively call the parent method to see if this is an
148
153
// input object, passing in the new prefix
149
- if ($ field -> type instanceof InputObjectType) {
154
+ if ($ type instanceof InputObjectType) {
150
155
// in case the field is a self reference we must not do
151
156
// a recursive call as it will never stop
152
- if ($ field -> type ->toString () == $ input ->toString ()) {
157
+ if ($ type ->toString () == $ input ->toString ()) {
153
158
continue ;
154
159
}
155
160
}
0 commit comments