@@ -136,6 +136,12 @@ func (s *Schema) Exec(ctx context.Context, queryString string, operationName str
136
136
}
137
137
138
138
func (s * Schema ) exec (ctx context.Context , queryString string , operationName string , variables map [string ]interface {}, res * resolvable.Schema ) * Response {
139
+
140
+ var (
141
+ logFailedInputValidationQueries , anyOtherValidationError bool
142
+ errMessage string
143
+ )
144
+
139
145
doc , qErr := query .Parse (queryString )
140
146
if qErr != nil {
141
147
return & Response {Errors : []* errors.QueryError {qErr }}
@@ -145,7 +151,20 @@ func (s *Schema) exec(ctx context.Context, queryString string, operationName str
145
151
errs := validation .Validate (s .schema , doc , variables , s .maxDepth )
146
152
validationFinish (errs )
147
153
if len (errs ) != 0 {
148
- return & Response {Errors : errs }
154
+ for _ , err := range errs {
155
+ if err .Rule == "VariablesOfCorrectType" {
156
+ logFailedInputValidationQueries = true
157
+ errMessage = fmt .Sprintln (errMessage , "\n " , err .Message )
158
+ } else if err .Rule != "" {
159
+ anyOtherValidationError = true
160
+ }
161
+ }
162
+ if anyOtherValidationError {
163
+ return & Response {Errors : errs }
164
+ }
165
+ if logFailedInputValidationQueries {
166
+ golog .Println ("**************\n " ,errMessage , "\n " , queryString , "\n **************" )
167
+ }
149
168
}
150
169
151
170
op , err := getOperation (doc , operationName )
0 commit comments