Skip to content

Commit

Permalink
change documentation term with spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Dec 2, 2023
1 parent f767844 commit 00f7f08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# OpenApiBundle

Provides a tight integration of the famous [`zircote/swagger-php`](https://github.com/zircote/swagger-php) library into the Symfony full-stack framework for generating
OpenAPI documentation and building Restful APIs quickly.
OpenAPI spec and building Restful APIs quickly.

This bundle is especially created for API-First development.

Expand Down
6 changes: 3 additions & 3 deletions src/Command/ExportOpenApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#[AsCommand(
name: 'openapi:export',
description: 'Export the OpenAPI documentation to a formatted file.',
description: 'Export the OpenAPI spec to a formatted file.',
)]
class ExportOpenApiCommand extends Command
{
Expand All @@ -34,15 +34,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output);

if (null === $openapi = $this->generator->generate()) {
$io->error('OpenAPI documentation not found.');
$io->error('OpenAPI spec not found.');

return self::FAILURE;
}

$filename = $input->getOption('output');
$openapi->saveAs($filename);

$io->success('OpenAPI documentation has been exported successfully.');
$io->success('OpenAPI spec has been exported successfully.');

return self::SUCCESS;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/OpenApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public function __construct(
public function index(UrlGeneratorInterface $urlGenerator): Response
{
if (null === $openapi = $this->generator->generate()) {
throw new NotFoundHttpException('OpenAPI documentation not found.');
throw new NotFoundHttpException('OpenAPI spec not found.');
}

$validationErrors = '';
try {
if (!$openapi->validate()) {
throw new \ErrorException('OpenAPI documentation is invalid.');
throw new \ErrorException('OpenAPI spec is invalid.');
}
} catch (\ErrorException $e) {
$validationErrors = $e->getMessage();
Expand All @@ -46,7 +46,7 @@ public function index(UrlGeneratorInterface $urlGenerator): Response
public function yaml(): Response
{
if (null === $openapi = $this->generator->generate()) {
throw new NotFoundHttpException('OpenAPI documentation not found.');
throw new NotFoundHttpException('OpenAPI spec not found.');
}

return new Response($openapi->toYaml(), 200, [
Expand All @@ -57,7 +57,7 @@ public function yaml(): Response
public function json(): JsonResponse
{
if (null === $openapi = $this->generator->generate()) {
throw new NotFoundHttpException('OpenAPI documentation not found.');
throw new NotFoundHttpException('OpenAPI spec not found.');
}

return new JsonResponse($openapi->toJson(), json: true);
Expand All @@ -66,7 +66,7 @@ public function json(): JsonResponse
public function jsonSchema(Request $request, string $name): JsonResponse
{
if (null === $openapi = $this->generator->generate()) {
throw new NotFoundHttpException('OpenAPI documentation not found.');
throw new NotFoundHttpException('OpenAPI spec not found.');
}

$openapi = json_decode($openapi->toJson(JSON_THROW_ON_ERROR), true, 512, JSON_THROW_ON_ERROR);
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/ExportOpenApiCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function testExportToJson(): void
]);

$tester->assertCommandIsSuccessful();
$this->assertStringContainsString('OpenAPI documentation has been exported successfully.', $tester->getDisplay());
$this->assertStringContainsString('OpenAPI spec has been exported successfully.', $tester->getDisplay());

$actual = trim(file_get_contents($filename));
$this->assertSameFileResponseContent($actual, 'doc.json');
Expand All @@ -28,7 +28,7 @@ public function testExportToYaml(): void
]);

$tester->assertCommandIsSuccessful();
$this->assertStringContainsString('OpenAPI documentation has been exported successfully.', $tester->getDisplay());
$this->assertStringContainsString('OpenAPI spec has been exported successfully.', $tester->getDisplay());

$actual = trim(file_get_contents($filename));
//file_put_contents(__DIR__.'/App/ExportOpenApiCommand/Output/doc.yaml', $actual);
Expand Down

0 comments on commit 00f7f08

Please sign in to comment.