-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Koen Caerels
committed
Apr 25, 2024
1 parent
5dbb2ee
commit b88b8ab
Showing
21 changed files
with
5,312 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
application/YoshiKan/Infrastructure/CLI/CreateApiDocumentation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\YoshiKan\Infrastructure\CLI; | ||
|
||
use Nelmio\ApiDocBundle\ApiDocGenerator; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class CreateApiDocumentation extends Command | ||
{ | ||
// —————————————————————————————————————————————————————————————————————————— | ||
// Constructor | ||
// —————————————————————————————————————————————————————————————————————————— | ||
|
||
public function __construct(private ApiDocGenerator $apiDocGenerator) | ||
{ | ||
parent::__construct('openapi:gen'); | ||
} | ||
|
||
// —————————————————————————————————————————————————————————————————————————— | ||
// Executor | ||
// —————————————————————————————————————————————————————————————————————————— | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$output->writeln('Start generating OpenAPI documentation'); | ||
$documentation = $this->apiDocGenerator->generate(); | ||
$json = json_encode($documentation, \JSON_PRETTY_PRINT); | ||
$jsonPath = './frontends/member_module/src/api/client/schema.json'; | ||
file_put_contents($jsonPath, $json); | ||
$output->writeln('Done generating OpenAPI documentation'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
application/YoshiKan/Infrastructure/Templates/api/api_documentation.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Yoshi Kan - API Reference</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<script id="api-reference" data-url="{{ path('api_documentation_schema') }}"></script> | ||
{# data-proxy-url="https://api.scalar.com/request-proxy" | ||
<!-- You can also set a full configuration object like this --> | ||
<!-- easier for nested objects --> | ||
#} | ||
<script> | ||
var configuration = { | ||
theme: 'purple', | ||
} | ||
var apiReference = document.getElementById('api-reference') | ||
apiReference.dataset.configuration = JSON.stringify(configuration) | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.