Skip to content

Commit 5a2053f

Browse files
authored
chore(laravel): only enable JSON-LD by default (#6528)
1 parent 5e1233c commit 5a2053f

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
->in(__DIR__)
1616
->exclude([
1717
'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
18+
'src/Laravel/config',
1819
'tests/Fixtures/app/var',
1920
'docs/guides',
2021
'docs/var',

src/Laravel/Tests/JsonApiTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
namespace ApiPlatform\Laravel\Tests;
1515

1616
use ApiPlatform\Laravel\Test\ApiTestAssertionsTrait;
17+
use Illuminate\Contracts\Config\Repository;
18+
use Illuminate\Foundation\Application;
1719
use Illuminate\Foundation\Testing\RefreshDatabase;
1820
use Orchestra\Testbench\Concerns\WithWorkbench;
1921
use Orchestra\Testbench\TestCase;
@@ -26,6 +28,16 @@ class JsonApiTest extends TestCase
2628
use RefreshDatabase;
2729
use WithWorkbench;
2830

31+
/**
32+
* @param Application $app
33+
*/
34+
protected function defineEnvironment($app): void
35+
{
36+
tap($app['config'], function (Repository $config): void {
37+
$config->set('api-platform.formats', ['jsonapi' => ['application/vnd.api+json']]);
38+
});
39+
}
40+
2941
public function testGetCollection(): void
3042
{
3143
$response = $this->get('/api/books', ['accept' => ['application/vnd.api+json']]);

src/Laravel/config/api-platform.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
<?php
22

3-
/*
4-
* This file is part of the API Platform project.
5-
*
6-
* (c) Kévin Dunglas <[email protected]>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
11-
12-
declare(strict_types=1);
13-
143
return [
154
'title' => 'API Platform',
165
'description' => 'My awesome API',
@@ -31,17 +20,17 @@
3120

3221
'formats' => [
3322
'jsonld' => ['application/ld+json'],
34-
'jsonapi' => ['application/vnd.api+json'],
23+
//'jsonapi' => ['application/vnd.api+json'],
3524
],
3625

3726
'patch_formats' => [
3827
'json' => ['application/merge-patch+json'],
3928
],
4029

4130
'docs_formats' => [
42-
'jsonopenapi' => ['application/vnd.openapi+json'],
43-
'json' => ['application/json'],
4431
'jsonld' => ['application/ld+json'],
32+
//'jsonapi' => ['application/vnd.api+json'],
33+
'jsonopenapi' => ['application/vnd.openapi+json'],
4534
'html' => ['text/html'],
4635
],
4736

0 commit comments

Comments
 (0)