protected function JsonApiGenerator::getJsonApiRoutes in OpenAPI for JSON:API 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php \Drupal\openapi_jsonapi\Plugin\openapi\OpenApiGenerator\JsonApiGenerator::getJsonApiRoutes()
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
File
- src/
Plugin/ openapi/ OpenApiGenerator/ JsonApiGenerator.php, line 265
Class
- JsonApiGenerator
- Defines an OpenApi Schema Generator for the JsonApi module.
Namespace
Drupal\openapi_jsonapi\Plugin\openapi\OpenApiGeneratorCode
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;
}