Skip to content

Commit

Permalink
Fix Missing Directory Error (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDaSilva authored Jun 7, 2024
1 parent f60af2f commit 9df0a55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.2.23</version>
<version>2.2.24</version>
<authors>
<author>
<name>Vincent Lopes-Vicente</name>
Expand Down
18 changes: 15 additions & 3 deletions Controller/OpenApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,27 @@ public function getDocumentation(Request $request)
{
header('Access-Control-Allow-Origin: *');

$annotations = Generator::scan(Util::finder([
$directories = [
THELIA_MODULE_DIR.'/*/Model/Api',
THELIA_MODULE_DIR.'/*/Model/OpenApi',
THELIA_MODULE_DIR.'/*/EventListener',
THELIA_MODULE_DIR.'/*/ApiExtend',
THELIA_MODULE_DIR.'/*/Controller',
]));
];

$validDirectories = [];

foreach ($directories as $directory) {
$matches = glob($directory);

if (!empty($matches)) {
$validDirectories[] = $directory;
}
}

$annotations = Generator::scan(Util::finder($validDirectories));

$annotations = json_decode($annotations->toJson(), true);
$annotations = json_decode($annotations?->toJson(), true);

$modelAnnotations = $annotations['components']['schemas'];
foreach ($modelAnnotations as $modelName => $modelAnnotation) {
Expand Down

0 comments on commit 9df0a55

Please sign in to comment.