code: public static function validate(
          Schema $schema,
          DocumentNode $ast,
          ?array $rules = null,
          ?TypeInfo $typeInfo = null
      ) {
          if ($rules === null) {
              $rules = static::allRules();
          }
  
          if (is_array($rules) === true && count($rules) === 0) {
              // Skip validation if there are no rules
              return [];
          }
  
          $typeInfo = $typeInfo ?: new TypeInfo($schema);
  
          return static::visitUsingRules($schema, $typeInfo, $ast, $rules);
      }
docs: Primary method for query validation. See class description for details.
  
  @param ValidationRule[]|null $rules
  
  @return Error[]
  
  @api