@@ -4,10 +4,10 @@ import (
4
4
"context"
5
5
"fmt"
6
6
7
+ "github.com/graph-gophers/graphql-go/ast"
7
8
"github.com/graph-gophers/graphql-go/errors"
8
9
"github.com/graph-gophers/graphql-go/internal/exec/resolvable"
9
10
"github.com/graph-gophers/graphql-go/internal/exec/selected"
10
- "github.com/graph-gophers/graphql-go/types"
11
11
)
12
12
13
13
func collectFieldsToValidate (sels []selected.Selection , s * resolvable.Schema , fields * []* fieldToValidate , fieldByAlias map [string ]* fieldToValidate ) {
@@ -69,18 +69,18 @@ func validateFieldSelection(ctx context.Context, s *resolvable.Schema, f *fieldT
69
69
return validateSelectionSet (ctx , f .sels , f .field .Type , path , s )
70
70
}
71
71
72
- func validateSelectionSet (ctx context.Context , sels []selected.Selection , typ types .Type , path * pathSegment , s * resolvable.Schema ) []* errors.QueryError {
72
+ func validateSelectionSet (ctx context.Context , sels []selected.Selection , typ ast .Type , path * pathSegment , s * resolvable.Schema ) []* errors.QueryError {
73
73
t , _ := unwrapNonNull (typ )
74
74
75
75
switch t .(type ) {
76
- case * types .ObjectTypeDefinition , * types .InterfaceTypeDefinition , * types .Union :
76
+ case * ast .ObjectTypeDefinition , * ast .InterfaceTypeDefinition , * ast .Union :
77
77
return validateSelections (ctx , sels , path , s )
78
78
}
79
79
80
80
switch t := t .(type ) {
81
- case * types .List :
81
+ case * ast .List :
82
82
return validateList (ctx , sels , t , path , s )
83
- case * types .ScalarTypeDefinition , * types .EnumTypeDefinition :
83
+ case * ast .ScalarTypeDefinition , * ast .EnumTypeDefinition :
84
84
// Field resolution already validated, don't need to check the value
85
85
default :
86
86
panic (fmt .Sprintf ("unexpected type %T" , t ))
@@ -100,7 +100,7 @@ func validateSelections(ctx context.Context, sels []selected.Selection, path *pa
100
100
return errs
101
101
}
102
102
103
- func validateList (ctx context.Context , sels []selected.Selection , typ * types .List , path * pathSegment , s * resolvable.Schema ) []* errors.QueryError {
103
+ func validateList (ctx context.Context , sels []selected.Selection , typ * ast .List , path * pathSegment , s * resolvable.Schema ) []* errors.QueryError {
104
104
// For lists, we only need to apply validation once. Nothing has been evaluated, so we have no list, and need to use '0' as the path index
105
105
return validateSelectionSet (ctx , sels , typ .OfType , & pathSegment {path , 0 }, s )
106
106
}
0 commit comments