func (r *Request) ValidateRestrictedFields(schema *Schema, restrictedFields []Type) (RequestFieldsValidationResult, error) {
	if schema == nil {
		return RequestFieldsValidationResult{Valid: false}, ErrNilSchema
	}
	report := r.parseQueryOnce()
	if report.HasErrors() {
		return fieldsValidationResult(report, false, "", "")
	}
	var fieldsValidator RequestFieldsValidator = DefaultFieldsValidator{}
	return fieldsValidator.Validate(r, schema, restrictedFields)
}
ValidateRestrictedFields validates a request by checking if `restrictedFields` contains blocked fields.

Deprecated: This function can only handle blocked fields. Use `ValidateFieldRestrictions` if you
want to check for blocked or allowed fields instead.
package graphql
import (
	"github.com/jensneuse/graphql-go-tools/pkg/astvalidation"
	"github.com/jensneuse/graphql-go-tools/pkg/operationreport"
)
type ValidationResult struct {
	Valid  bool
	Errors Errors
}
func (r *Request) ValidateForSchema(schema *Schema) (result ValidationResult, err error) {
	if schema == nil {
		return ValidationResult{Valid: false, Errors: nil}, ErrNilSchema
	}
	schemaHash, err := schema.Hash()
	if err != nil {
		return ValidationResult{Valid: false}, err
	}
	if r.validForSchema == nil {
		r.validForSchema = map[uint64]ValidationResult{}
	}
	if result, ok := r.validForSchema[schemaHash]; ok {
		return result, nil
	}
	report := r.parseQueryOnce()
	if report.HasErrors() {
		return operationValidationResultFromReport(report)
	}
	validator := astvalidation.DefaultOperationValidator()
	validator.Validate(&r.document, &schema.document, &report)
	result, err = operationValidationResultFromReport(report)
	if err != nil {
		return result, err
	}
	r.validForSchema[schemaHash] = result
	return result, err
}