You are here

public function ApiSpecificationController::getSpecification in OpenAPI 8

Same name and namespace in other branches
  1. 8.2 src/Controller/ApiSpecificationController.php \Drupal\openapi\Controller\ApiSpecificationController::getSpecification()

Gets the OpenAPI output in JSON format.

Return value

\Symfony\Component\HttpFoundation\JsonResponse The JSON response.

1 string reference to 'ApiSpecificationController::getSpecification'
openapi.routing.yml in ./openapi.routing.yml
openapi.routing.yml

File

src/Controller/ApiSpecificationController.php, line 36

Class

ApiSpecificationController
API Specification controller base.

Namespace

Drupal\openapi\Controller

Code

public function getSpecification(OpenApiGeneratorInterface $openapi_generator, Request $request) {
  $options = $request
    ->get('options', []);
  $openapi_generator
    ->setOptions($options);
  $spec = $openapi_generator
    ->getSpecification();
  return new JsonResponse($spec);
}