@@ -136,6 +136,12 @@ func (s *Schema) Exec(ctx context.Context, queryString string, operationName str
136136}
137137
138138func (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+
139145 doc , qErr := query .Parse (queryString )
140146 if qErr != nil {
141147 return & Response {Errors : []* errors.QueryError {qErr }}
@@ -145,7 +151,20 @@ func (s *Schema) exec(ctx context.Context, queryString string, operationName str
145151 errs := validation .Validate (s .schema , doc , variables , s .maxDepth )
146152 validationFinish (errs )
147153 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+ }
149168 }
150169
151170 op , err := getOperation (doc , operationName )
0 commit comments