Skip to content

Commit 42991b9

Browse files
authoredMar 13, 2025··
feat(laravel): openapi export command (#7016)
1 parent dd1b89f commit 42991b9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎src/Laravel/ApiPlatformProvider.php

+6
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
use ApiPlatform\Metadata\UrlGeneratorInterface;
166166
use ApiPlatform\Metadata\Util\Inflector;
167167
use ApiPlatform\Metadata\Util\ReflectionClassRecursiveIterator;
168+
use ApiPlatform\OpenApi\Command\OpenApiCommand;
168169
use ApiPlatform\OpenApi\Factory\OpenApiFactory;
169170
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
170171
use ApiPlatform\OpenApi\Options;
@@ -842,6 +843,10 @@ public function register(): void
842843
);
843844
});
844845

846+
$this->app->singleton(OpenApiCommand::class, function (Application $app) {
847+
return new OpenApiCommand($app->make(OpenApiFactory::class), $app->make(Serializer::class));
848+
});
849+
845850
$this->app->bind(DefinitionNameFactoryInterface::class, DefinitionNameFactory::class);
846851
$this->app->singleton(DefinitionNameFactory::class, function (Application $app) {
847852
/** @var ConfigRepository */
@@ -1100,6 +1105,7 @@ function (Application $app) {
11001105
Console\InstallCommand::class,
11011106
Console\Maker\MakeStateProcessorCommand::class,
11021107
Console\Maker\MakeStateProviderCommand::class,
1108+
OpenApiCommand::class,
11031109
]);
11041110
}
11051111

‎src/OpenApi/composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"api-platform/metadata": "^4.1",
3333
"api-platform/state": "^4.1",
3434
"symfony/console": "^6.4 || ^7.0",
35+
"symfony/filesystem": "^7.2",
3536
"symfony/property-access": "^6.4 || ^7.0",
3637
"symfony/serializer": "^6.4 || ^7.0"
3738
},

0 commit comments

Comments
 (0)
Please sign in to comment.