code: public function createResourceValidator(
          ResourceObject $resource,
          array $rules,
          array $messages = [],
          array $customAttributes = []
      ) {
          return $this->createValidator(
              $resource->all(),
              $rules,
              $messages,
              $customAttributes,
              function ($key, $detail, $failed) use ($resource) {
                  return $this->invalidResource(
                      $resource->pointer($key, '/data'),
                      $detail,
                      $failed
                  );
              }
          );
      }
docs: Create a JSON API resource object validator.
  
  @param ResourceObject $resource
  @param array $rules
  @param array $messages
  @param array $customAttributes
  @return ValidatorInterface