mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-09 06:13:17 +01:00
Fix API docs generation with Scramble 0.13
Scramble 0.13 moved the collected resource type of resource collections to a different template slot, which broke the custom paginated resource collection extension and the API docs export. Scramble now infers paginated responses natively, so the extension, the marker interface and the @return annotations that overrode the inference are removed. Scramble 0.13 also documents closure routes, so the API fallback routes are moved to a controller that is excluded from the docs. Add a test that exports the API docs.
This commit is contained in:
committed by
Constantin Graf
parent
fde944a84f
commit
ed2f19f58b
21
app/Http/Controllers/Api/FallbackController.php
Normal file
21
app/Http/Controllers/Api/FallbackController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Dedoc\Scramble\Attributes\ExcludeAllRoutesFromDocs;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Fallback for unknown /api/* routes, to prevent a rendered HTML page
|
||||
*/
|
||||
#[ExcludeAllRoutesFromDocs]
|
||||
class FallbackController extends Controller
|
||||
{
|
||||
public function __invoke(): never
|
||||
{
|
||||
throw new NotFoundHttpException('API resource not found');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user