Skip to content

Commit 1229af0

Browse files
authored
feat: change swagger3 (#8)
1 parent ac751db commit 1229af0

File tree

8 files changed

+83
-66
lines changed

8 files changed

+83
-66
lines changed

templates/controller_docs/destroy.stub

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22
* @param int $id
33
* @return Response
44
*
5-
* @SWG\Delete(
5+
* @OA\Delete(
66
* path="/$MODEL_NAME_PLURAL_CAMEL$/{id}",
7-
* summary="Remove the specified $MODEL_NAME$ from storage",
7+
* summary="delete$MODEL_NAME$",
88
* tags={"$MODEL_NAME$"},
99
* description="Delete $MODEL_NAME$",
10-
* produces={"application/json"},
11-
* @SWG\Parameter(
10+
* @OA\Parameter(
1211
* name="id",
1312
* description="id of $MODEL_NAME$",
14-
* type="integer",
13+
* @OA\Schema(
14+
* type="integer"
15+
* ),
1516
* required=true,
1617
* in="path"
1718
* ),
18-
* @SWG\Response(
19+
* @OA\Response(
1920
* response=200,
2021
* description="successful operation",
21-
* @SWG\Schema(
22+
* @OA\Schema(
2223
* type="object",
23-
* @SWG\Property(
24+
* @OA\Property(
2425
* property="success",
2526
* type="boolean"
2627
* ),
27-
* @SWG\Property(
28+
* @OA\Property(
2829
* property="data",
2930
* type="string"
3031
* ),
31-
* @SWG\Property(
32+
* @OA\Property(
3233
* property="message",
3334
* type="string"
3435
* )

templates/controller_docs/index.stub

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
* @param Request $request
33
* @return Response
44
*
5-
* @SWG\Get(
5+
* @OA\Get(
66
* path="/$MODEL_NAME_PLURAL_CAMEL$",
7-
* summary="Get a listing of the $MODEL_NAME_PLURAL$.",
7+
* summary="get$MODEL_NAME$List",
88
* tags={"$MODEL_NAME$"},
99
* description="Get all $MODEL_NAME_PLURAL$",
10-
* produces={"application/json"},
11-
* @SWG\Response(
10+
* @OA\Response(
1211
* response=200,
1312
* description="successful operation",
14-
* @SWG\Schema(
13+
* @OA\Schema(
1514
* type="object",
16-
* @SWG\Property(
15+
* @OA\Property(
1716
* property="success",
1817
* type="boolean"
1918
* ),
20-
* @SWG\Property(
19+
* @OA\Property(
2120
* property="data",
2221
* type="array",
23-
* @SWG\Items(ref="#/definitions/$MODEL_NAME$")
22+
* @OA\Items(ref="#/definitions/$MODEL_NAME$")
2423
* ),
25-
* @SWG\Property(
24+
* @OA\Property(
2625
* property="message",
2726
* type="string"
2827
* )

templates/controller_docs/show.stub

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22
* @param int $id
33
* @return Response
44
*
5-
* @SWG\Get(
5+
* @OA\Get(
66
* path="/$MODEL_NAME_PLURAL_CAMEL$/{id}",
7-
* summary="Display the specified $MODEL_NAME$",
7+
* summary="get$MODEL_NAME$Item",
88
* tags={"$MODEL_NAME$"},
99
* description="Get $MODEL_NAME$",
10-
* produces={"application/json"},
11-
* @SWG\Parameter(
10+
* @OA\Parameter(
1211
* name="id",
1312
* description="id of $MODEL_NAME$",
14-
* type="integer",
13+
* @OA\Schema(
14+
* type="integer"
15+
* ),
1516
* required=true,
1617
* in="path"
1718
* ),
18-
* @SWG\Response(
19+
* @OA\Response(
1920
* response=200,
2021
* description="successful operation",
21-
* @SWG\Schema(
22+
* @OA\Schema(
2223
* type="object",
23-
* @SWG\Property(
24+
* @OA\Property(
2425
* property="success",
2526
* type="boolean"
2627
* ),
27-
* @SWG\Property(
28+
* @OA\Property(
2829
* property="data",
2930
* ref="#/definitions/$MODEL_NAME$"
3031
* ),
31-
* @SWG\Property(
32+
* @OA\Property(
3233
* property="message",
3334
* type="string"
3435
* )

templates/controller_docs/store.stub

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
11
/**
2-
* @param Create$MODEL_NAME$APIRequest $request
2+
* @param Request $request
33
* @return Response
44
*
5-
* @SWG\Post(
5+
* @OA\Post(
66
* path="/$MODEL_NAME_PLURAL_CAMEL$",
7-
* summary="Store a newly created $MODEL_NAME$ in storage",
7+
* summary="create$MODEL_NAME$",
88
* tags={"$MODEL_NAME$"},
9-
* description="Store $MODEL_NAME$",
10-
* produces={"application/json"},
11-
* @SWG\Parameter(
12-
* name="body",
13-
* in="body",
14-
* description="$MODEL_NAME$ that should be stored",
15-
* required=false,
16-
* @SWG\Schema(ref="#/definitions/$MODEL_NAME$")
9+
* description="Create $MODEL_NAME$",
10+
* @OA\RequestBody(
11+
* required=true,
12+
* @OA\MediaType(
13+
* mediaType="application/x-www-form-urlencoded",
14+
* @OA\Schema(
15+
* type="object",
16+
* required={""},
17+
* @OA\Property(
18+
* property="name",
19+
* description="desc",
20+
* type="string"
21+
* )
22+
* )
23+
* )
1724
* ),
18-
* @SWG\Response(
25+
* @OA\Response(
1926
* response=200,
2027
* description="successful operation",
21-
* @SWG\Schema(
28+
* @OA\Schema(
2229
* type="object",
23-
* @SWG\Property(
30+
* @OA\Property(
2431
* property="success",
2532
* type="boolean"
2633
* ),
27-
* @SWG\Property(
34+
* @OA\Property(
2835
* property="data",
2936
* ref="#/definitions/$MODEL_NAME$"
3037
* ),
31-
* @SWG\Property(
38+
* @OA\Property(
3239
* property="message",
3340
* type="string"
3441
* )

templates/controller_docs/update.stub

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,51 @@
11
/**
22
* @param int $id
3-
* @param Update$MODEL_NAME$APIRequest $request
3+
* @param Request $request
44
* @return Response
55
*
6-
* @SWG\Put(
6+
* @OA\Put(
77
* path="/$MODEL_NAME_PLURAL_CAMEL$/{id}",
8-
* summary="Update the specified $MODEL_NAME$ in storage",
8+
* summary="update$MODEL_NAME$",
99
* tags={"$MODEL_NAME$"},
1010
* description="Update $MODEL_NAME$",
11-
* produces={"application/json"},
12-
* @SWG\Parameter(
11+
* @OA\Parameter(
1312
* name="id",
1413
* description="id of $MODEL_NAME$",
15-
* type="integer",
14+
* @OA\Schema(
15+
* type="integer"
16+
* ),
1617
* required=true,
1718
* in="path"
1819
* ),
19-
* @SWG\Parameter(
20-
* name="body",
21-
* in="body",
22-
* description="$MODEL_NAME$ that should be updated",
23-
* required=false,
24-
* @SWG\Schema(ref="#/definitions/$MODEL_NAME$")
20+
* @OA\RequestBody(
21+
* required=true,
22+
* @OA\MediaType(
23+
* mediaType="application/x-www-form-urlencoded",
24+
* @OA\Schema(
25+
* type="object",
26+
* required={""},
27+
* @OA\Property(
28+
* property="name",
29+
* description="desc",
30+
* type="string"
31+
* )
32+
* )
33+
* )
2534
* ),
26-
* @SWG\Response(
35+
* @OA\Response(
2736
* response=200,
2837
* description="successful operation",
29-
* @SWG\Schema(
38+
* @OA\Schema(
3039
* type="object",
31-
* @SWG\Property(
40+
* @OA\Property(
3241
* property="success",
3342
* type="boolean"
3443
* ),
35-
* @SWG\Property(
44+
* @OA\Property(
3645
* property="data",
3746
* ref="#/definitions/$MODEL_NAME$"
3847
* ),
39-
* @SWG\Property(
48+
* @OA\Property(
4049
* property="message",
4150
* type="string"
4251
* )

templates/model_docs/model.stub

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @SWG\Definition(
3-
* definition="$MODEL_NAME$",
2+
* @OA\Schema(
3+
* schema="$MODEL_NAME$",
44
* required={$REQUIRED_FIELDS$},
55
$PROPERTIES$
66
* )

templates/model_docs/parameter.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* @SWG\Parameter(
1+
* @OA\Parameter(
22
* name="$FIELD_NAME$",
33
* in="query",
44
* description="$DESCRIPTION$",

templates/model_docs/property.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* @SWG\Property(
1+
* @OA\Property(
22
* property="$FIELD_NAME$",
33
* description="$DESCRIPTION$",
44
* type="$FIELD_TYPE$"$FIELD_FORMAT$

0 commit comments

Comments
 (0)