code: public function validate()
      {
          // If this Schema has already been validated, return the previous results.
          if ($this->validationErrors !== null) {
              return $this->validationErrors;
          }
          // Validate the schema, producing a list of errors.
          $context = new SchemaValidationContext($this);
          $context->validateRootTypes();
          $context->validateDirectives();
          $context->validateTypes();
  
          // Persist the results of validation before returning to ensure validation
          // does not run multiple times for this schema.
          $this->validationErrors = $context->getErrors();
  
          return $this->validationErrors;
      }
docs: Validates schema.
  
  This operation requires full schema scan. Do not use in production environment.
  
  @return InvariantViolation[]|Error[]
  
  @api