-
Notifications
You must be signed in to change notification settings - Fork 6
PS-906_initial-values-tests & documentation generation #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jygaulier
wants to merge
33
commits into
master
Choose a base branch
from
PS-906_initial-values-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
2c3b6f1
wip
jygaulier af41bc5
wip
jygaulier 1bbba71
wip
jygaulier d195a25
wip
jygaulier cb1ce74
fix
jygaulier 2c17f36
auto-find documentation generators ; output to stdout or file
jygaulier b353a8a
Merge branch 'master' into PS-906_initial-values-tests
jygaulier f7bb49b
Merge branch 'PS-906_initial-values-tests' of github.com:alchemy-fr/p…
jygaulier eb88c0f
cs
jygaulier f2cbf61
add multi-chapters (recursive), with numbered levels
jygaulier 7b0b9a5
add tests and allow empty metadata in tests
jygaulier fbbc695
Merge branch 'master' into PS-906_initial-values-tests
jygaulier b0b6e4e
move test data provider to src (because used to generate doc) ; add f…
jygaulier c46925c
remove app:documentation:dump options
jygaulier baf4542
add generated doc to git
jygaulier 377b7b9
apply review
jygaulier a3fd199
wip
jygaulier c28b48b
wip
jygaulier b3067d0
wip
jygaulier 759807a
wip
jygaulier 8b88685
fix
jygaulier 1223044
auto-find documentation generators ; output to stdout or file
jygaulier bb40530
cs
jygaulier c933e4a
add multi-chapters (recursive), with numbered levels
jygaulier 3dc8aae
add tests and allow empty metadata in tests
jygaulier bf785bc
move test data provider to src (because used to generate doc) ; add f…
jygaulier 5869216
remove app:documentation:dump options
jygaulier 68a4229
add generated doc to git
jygaulier 7269658
apply review
jygaulier c87d32d
remove generated doc
jygaulier 12bd7f4
generates databox-api schema (json)
jygaulier 44147cb
Merge branch 'master' into PS-906_initial-values-tests
jygaulier 39101c1
Merge branch 'PS-906_initial-values-tests' of github.com:alchemy-fr/p…
jygaulier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
42 changes: 42 additions & 0 deletions
42
databox/api/src/Documentation/ApiDocumentationGenerator.php
This file contains hidden or 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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Documentation; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Output\BufferedOutput; | ||
use Symfony\Component\HttpKernel\KernelInterface; | ||
|
||
class ApiDocumentationGenerator extends DocumentationGenerator | ||
{ | ||
private Application $application; | ||
|
||
public function __construct(KernelInterface $kernel) | ||
{ | ||
$this->application = new Application($kernel); | ||
$this->application->setAutoExit(false); | ||
} | ||
|
||
public function getPath(): string | ||
{ | ||
return 'Databox/Api/schema.json'; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return 'Api Schema'; | ||
} | ||
|
||
public function getContent(): string | ||
{ | ||
$input = new ArrayInput([ | ||
'command' => 'api:openapi:export', | ||
]); | ||
$output = new BufferedOutput(); | ||
$this->application->run($input, $output); | ||
|
||
return $output->fetch(); | ||
} | ||
} |
This file contains hidden or 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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Documentation; | ||
|
||
abstract class DocumentationGenerator implements DocumentationGeneratorInterface | ||
{ | ||
private array $levels = []; | ||
|
||
final public function setLevels(array $levels): void | ||
{ | ||
$this->levels = $levels; | ||
} | ||
|
||
final public function getLevels(): array | ||
{ | ||
return $this->levels; | ||
} | ||
|
||
public function getHeader(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function getContent(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function getFooter(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
/** DocumentationGeneratorInterface[] */ | ||
public function getChildren(): array | ||
{ | ||
return []; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
databox/api/src/Documentation/DocumentationGeneratorInterface.php
This file contains hidden or 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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Documentation; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; | ||
|
||
#[AutoconfigureTag(DocumentationGeneratorInterface::TAG)] | ||
interface DocumentationGeneratorInterface | ||
{ | ||
final public const string TAG = 'documentation_generator'; | ||
|
||
public function getPath(): string; | ||
|
||
public function setLevels(array $levels): void; | ||
|
||
public function getLevels(): array; | ||
|
||
public function getHeader(): ?string; | ||
|
||
public function getContent(): ?string; | ||
|
||
public function getFooter(): ?string; | ||
|
||
/** DocumentationGeneratorInterface[] */ | ||
public function getChildren(): array; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.