Skip to content

Commit

Permalink
fix(laravel): entrypoint with doc formats (#6552)
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka authored Aug 28, 2024
1 parent 5386488 commit a1dd0b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Laravel/ApiPlatformProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
use ApiPlatform\Laravel\Security\ResourceAccessChecker;
use ApiPlatform\Laravel\State\AccessCheckerProvider;
use ApiPlatform\Laravel\State\SwaggerUiProcessor;
use ApiPlatform\Laravel\State\SwaggerUiProvider;
use ApiPlatform\Laravel\State\ValidateProvider;
use ApiPlatform\Metadata\Exception\NotExposedHttpException;
use ApiPlatform\Metadata\Factory\Property\ClassLevelAttributePropertyNameCollectionFactory;
Expand Down Expand Up @@ -395,8 +396,12 @@ public function register(): void
return new ReadProvider($app->make(CallableProvider::class));
});

$this->app->singleton(SwaggerUiProvider::class, function (Application $app) {
return new SwaggerUiProvider($app->make(ReadProvider::class), $app->make(OpenApiFactoryInterface::class));
});

$this->app->singleton(ValidateProvider::class, function (Application $app) {
return new ValidateProvider($app->make(ReadProvider::class), $app);
return new ValidateProvider($app->make(SwaggerUiProvider::class), $app);
});

$this->app->singleton(JsonApiProvider::class, function (Application $app) use ($config) {
Expand Down Expand Up @@ -587,7 +592,7 @@ public function register(): void
});

$this->app->singleton(EntrypointAction::class, function (Application $app) use ($config) {
return new EntrypointAction($app->make(ResourceNameCollectionFactoryInterface::class), $app->make(ProviderInterface::class), $app->make(ProcessorInterface::class), $config->get('api-platform.formats'));
return new EntrypointAction($app->make(ResourceNameCollectionFactoryInterface::class), $app->make(ProviderInterface::class), $app->make(ProcessorInterface::class), $config->get('api-platform.docs_formats'));
});

$this->app->singleton(Pagination::class, function () use ($config) {
Expand Down
1 change: 1 addition & 0 deletions src/Laravel/Tests/JsonApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ protected function defineEnvironment($app): void
{
tap($app['config'], function (Repository $config): void {
$config->set('api-platform.formats', ['jsonapi' => ['application/vnd.api+json']]);
$config->set('api-platform.docs_formats', ['jsonapi' => ['application/vnd.api+json']]);
});
}

Expand Down

0 comments on commit a1dd0b5

Please sign in to comment.