generate([ __DIR__ . '/../Controllers', __DIR__ . '/../Models', __DIR__ . '/../Http/Responses', ]); $response = new Response(); if ( $request->getHeaderLine('Accept') === 'application/json' || str_contains($request->getUri()->getPath(), '.json') ) { $response->getBody()->write($openapi->toJson()); return $response->withHeader('Content-Type', 'application/json'); } $response->getBody()->write($openapi->toYaml()); return $response->withHeader('Content-Type', 'application/x-yaml'); } }