diff --git a/graphql.go b/graphql.go index 93ca3e3d..14d62f9b 100644 --- a/graphql.go +++ b/graphql.go @@ -142,13 +142,12 @@ type Response struct { } // Validate validates the given query with the schema. -func (s *Schema) Validate(queryString string) []*errors.QueryError { +func (s *Schema) Validate(queryString string, variables map[string]interface{}) []*errors.QueryError { doc, qErr := query.Parse(queryString) if qErr != nil { return []*errors.QueryError{qErr} } - - return validation.Validate(s.schema, doc, nil, s.maxDepth) + return validation.Validate(s.schema, doc, variables, s.maxDepth) } // Exec executes the given query with the schema's resolver. It panics if the schema was created @@ -181,7 +180,7 @@ func (s *Schema) exec(ctx context.Context, queryString string, operationName str // Subscriptions are not valid in Exec. Use schema.Subscribe() instead. if op.Type == query.Subscription { - return &Response{Errors: []*errors.QueryError{&errors.QueryError{ Message: "graphql-ws protocol header is missing" }}} + return &Response{Errors: []*errors.QueryError{&errors.QueryError{Message: "graphql-ws protocol header is missing"}}} } // Fill in variables with the defaults from the operation