You are here

protected function RestGenerator::getRouteParameters in OpenAPI 8

Get OpenAPI parameters for a route.

Parameters

\Symfony\Component\Routing\Route $route: The route.

Return value

array The resource parameters.

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

File

src/Plugin/openapi/OpenApiGenerator/RestGenerator.php, line 355

Class

RestGenerator
Defines an OpenApi Schema Generator for the Rest module.

Namespace

Drupal\openapi\Plugin\openapi\OpenApiGenerator

Code

protected function getRouteParameters(Route $route) {
  $parameters = [];
  $vars = $route
    ->compile()
    ->getPathVariables();
  foreach ($vars as $var) {
    $parameters[] = [
      'name' => $var,
      'type' => 'string',
      'in' => 'path',
      'required' => TRUE,
    ];
  }
  return $parameters;
}