mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
✨ **Add public API documentation access and navigation links**
- 📚 Added "API Dokumentation" link to the sidebar and header navigation. - 🔓 Defined `viewApiDocs` gate for public access to API documentation. - ✅ Added feature tests for API documentation route accessibility and OpenAPI document serving.
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Foundation\Events\DiagnosingHealth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
@@ -37,6 +38,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
Gate::define('viewApiDocs', fn (?Authenticatable $user = null): bool => true);
|
||||
|
||||
if ($this->app->environment('production')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
@@ -116,15 +116,15 @@
|
||||
<flux:spacer/>
|
||||
|
||||
<flux:navlist variant="outline">
|
||||
<flux:navlist.item icon="book-open-text" :href="route('scramble.docs.ui')" target="_blank">
|
||||
{{ __('API Dokumentation') }}
|
||||
</flux:navlist.item>
|
||||
|
||||
<flux:navlist.item icon="folder-git-2"
|
||||
href="https://gitworkshop.dev/holgerhatgarkeinenode@einundzwanzig.space/einundzwanzig-app"
|
||||
target="_blank">
|
||||
{{ __('Repository') }}
|
||||
</flux:navlist.item>
|
||||
|
||||
<flux:navlist.item icon="book-open-text" href="https://laravel.com/docs/starter-kits#livewire" target="_blank">
|
||||
{{ __('Documentation') }}
|
||||
</flux:navlist.item>
|
||||
</flux:navlist>
|
||||
</flux:sidebar>
|
||||
|
||||
|
||||
@@ -127,6 +127,11 @@
|
||||
<flux:spacer/>
|
||||
|
||||
<flux:navlist variant="outline">
|
||||
<flux:navlist.item icon="book-open-text"
|
||||
:href="route('scramble.docs.ui')"
|
||||
target="_blank">
|
||||
{{ __('API Dokumentation') }}
|
||||
</flux:navlist.item>
|
||||
<flux:navlist.item icon="folder-git-2"
|
||||
href="https://gitworkshop.dev/holgerhatgarkeinenode@einundzwanzig.space/einundzwanzig-app"
|
||||
target="_blank">
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
it('exposes the api docs route publicly', function () {
|
||||
expect(Gate::forUser(null)->allows('viewApiDocs'))->toBeTrue();
|
||||
});
|
||||
|
||||
it('allows guests to open the api documentation', function () {
|
||||
$this->get(route('scramble.docs.ui'))->assertSuccessful();
|
||||
});
|
||||
|
||||
it('serves the openapi document to guests', function () {
|
||||
$this->get(route('scramble.docs.document'))->assertSuccessful();
|
||||
});
|
||||
Reference in New Issue
Block a user