-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Swagger for NDLA endpoints (#2835)
* add swagger * Run php-cs-fixer * fix namespace * document locale format --------- Co-authored-by: emmachughes <[email protected]>
- Loading branch information
1 parent
3efb996
commit 5433bf3
Showing
9 changed files
with
2,162 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
sourcecode/hub/app/Http/Controllers/NdlaLegacy/SwaggerController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Controllers\NdlaLegacy; | ||
|
||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Response; | ||
use Symfony\Component\HttpFoundation\BinaryFileResponse; | ||
|
||
use function resource_path; | ||
|
||
/** | ||
* @deprecated This exists for compatibility with old integrations. New | ||
* integrations with Edlib should not use this. | ||
*/ | ||
final readonly class SwaggerController | ||
{ | ||
public function swagger(): Response | ||
{ | ||
return response()->view('ndla-legacy.swagger'); | ||
} | ||
|
||
public function redirect(): RedirectResponse | ||
{ | ||
return redirect()->route('ndla-legacy.swagger', status: Response::HTTP_PERMANENTLY_REDIRECT); | ||
} | ||
|
||
public function schema(): BinaryFileResponse | ||
{ | ||
return response()->file(resource_path('schema/ndla-openapi.json'), [ | ||
'Content-Type' => 'application/json', | ||
]); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import SwaggerUI from 'swagger-ui'; | ||
import 'swagger-ui/dist/swagger-ui.css'; | ||
|
||
SwaggerUI({ | ||
dom_id: '#swagger', | ||
url: document.documentElement.getAttribute('data-openapi-url'), | ||
}); |
Oops, something went wrong.