You are here

protected function JsonApiGenerator::getJsonApiRoutes in OpenAPI 8

Gets the JSON API routes.

Return value

\Symfony\Component\Routing\Route[] The routes.

1 call to JsonApiGenerator::getJsonApiRoutes()
JsonApiGenerator::getPaths in src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
Returns the paths information.

File

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

Class

JsonApiGenerator
Defines an OpenApi Schema Generator for the JsonApi module.

Namespace

Drupal\openapi\Plugin\openapi\OpenApiGenerator

Code

protected function getJsonApiRoutes() {
  $all_routes = $this->routingProvider
    ->getAllRoutes();
  $jsonapi_routes = [];
  $jsonapi_base_path = $this
    ->getJsonApiBase();

  /** @var \Symfony\Component\Routing\Route $route */
  foreach ($all_routes as $route_name => $route) {
    $is_jsonapi = $route
      ->getDefault(JsonApiRoutes::JSON_API_ROUTE_FLAG_KEY);
    $is_entry_point = $route
      ->getPath() === $jsonapi_base_path;
    if (!$is_jsonapi || $is_entry_point) {
      continue;
    }
    $jsonapi_routes[$route_name] = $route;
  }
  return $jsonapi_routes;
}