Skip to content

Commit aa549d1

Browse files
committed
feat: added swagger api docs
1 parent eec977e commit aa549d1

File tree

6 files changed

+817
-73
lines changed

6 files changed

+817
-73
lines changed

app/Http/Controllers/Controller.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
use Illuminate\Foundation\Validation\ValidatesRequests;
77
use Illuminate\Routing\Controller as BaseController;
88

9+
/**
10+
* @OA\Info(
11+
* title="Femtolink API Documentation",
12+
* version="1.0.0",
13+
* )
14+
* @OA\Tag(
15+
* name="Links",
16+
* description="Operations about links"
17+
* ),
18+
* @OA\SecurityScheme(
19+
* type="http",
20+
* securityScheme="bearerAuth",
21+
* scheme="bearer",
22+
* bearerFormat="JWT"
23+
* )
24+
*
25+
*/
926
class Controller extends BaseController
1027
{
1128
use AuthorizesRequests, ValidatesRequests;

app/Http/Controllers/LinkController.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ public function get(string $short_url)
1717
return abort(404);
1818
}
1919

20+
21+
/**
22+
* @OA\Post(
23+
* path="/api/link",
24+
* summary="Create a new shorted link",
25+
* tags={"Links"},
26+
* @OA\Parameter(
27+
* name="long_url",
28+
* in="query",
29+
* description="The long URL to be shortened",
30+
* required=true,
31+
* @OA\Schema(type="string")
32+
* ),
33+
* @OA\Response(response="200", description="Link created successfully"),
34+
* @OA\Response(response="401", description="Unauthorized"),
35+
* @OA\Response(response="400", description="Bad Request"),
36+
* security={{"bearerAuth":{}}}
37+
* )
38+
*/
2039
public function store(Request $request)
2140
{
2241

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"license": "MIT",
77
"require": {
88
"php": "^8.1",
9+
"darkaonline/l5-swagger": "^8.6",
910
"guzzlehttp/guzzle": "^7.2",
1011
"laravel/framework": "^10.10",
1112
"laravel/sanctum": "^3.3",

0 commit comments

Comments
 (0)