You are here

protected function JsonApiGenerator::getResourceType in OpenAPI for JSON:API 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php \Drupal\openapi_jsonapi\Plugin\openapi\OpenApiGenerator\JsonApiGenerator::getResourceType()

Gets a Resource Type.

Parameters

string $route_name: The JSON API route name for which the ResourceType is wanted.

\Symfony\Component\Routing\Route $route: The JSON API route for which the ResourceType is wanted.

Return value

\Drupal\jsonapi\ResourceType\ResourceType Returns the ResourceType for the given JSON API route.

4 calls to JsonApiGenerator::getResourceType()
JsonApiGenerator::getEntityResponsesJsonApi in src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
JsonApiGenerator::getPaths in src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
JsonApiGenerator::getRouteMethodSummary in src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
Gets description of a method on a route.
JsonApiGenerator::relatedResourceType in src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
Gets the related Resource Type.

File

src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php, line 920

Class

JsonApiGenerator
Defines an OpenApi Schema Generator for the JsonApi module.

Namespace

Drupal\openapi_jsonapi\Plugin\openapi\OpenApiGenerator

Code

protected function getResourceType($route_name, Route $route) {
  $parameters[RouteObjectInterface::ROUTE_NAME] = $route_name;
  $parameters[RouteObjectInterface::ROUTE_OBJECT] = $route;
  $upcasted_parameters = $this->paramConverterManager
    ->convert($parameters + $route
    ->getDefaults());
  return $upcasted_parameters[JsonApiRoutes::RESOURCE_TYPE_KEY];
}