Skip to content

Commit

Permalink
feat: task swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
hekmatinasser committed Feb 22, 2024
1 parent 762a4b7 commit 3f11e2b
Show file tree
Hide file tree
Showing 2 changed files with 379 additions and 0 deletions.
110 changes: 110 additions & 0 deletions app/Documents/Task.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

namespace App\Documents;

/**
*
* @OA\Schema(schema="TasksResource", type="object", example={ "messages": { { "type": "success", "text": "responser::response.info" } }, "data": {{ "id": 3, "user": { "id": 1, "name": null, "email": "[email protected]", "created_at": "2024-02-22 22:00:13" }, "title": "Indoor sports", "description": null, "completed_at": null, "created_at": "2024-02-22 22:05:07" }}, "meta": {} })
* @OA\Schema(schema="TaskResource", type="object", example={ "messages": { { "type": "success", "text": "responser::response.info" } }, "data": { "id": 3, "user": { "id": 1, "name": null, "email": "[email protected]", "created_at": "2024-02-22 22:00:13" }, "title": "Indoor sports", "description": null, "completed_at": null, "created_at": "2024-02-22 22:05:07" }, "meta": {} })
*
* @OA\Post(
* path="/api/tasks",
* tags={"Task"},
* summary="Task Create API",
* security={{"bearerAuth":{}}},
* @OA\RequestBody(required=true,
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(required={},
* example={"title": "Indoor sports"}
* )
* )
* ),
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TaskResource")
* )
* ),
* )
*
* @OA\Patch (
* path="/api/tasks/{id}",
* tags={"Task"},
* summary="Task Update API",
* security={{"bearerAuth":{}}},
* @OA\Parameter(name="id",in="path",description="id",@OA\Schema(type="integer")),
* @OA\RequestBody(required=true,
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(required={},
* example={"title": "Indoor sports","description": "4*10 Stretching movement"}
* )
* )
* ),
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TaskResource")
* )
* ),
* )
*
*
* @OA\Get (
* path="/api/tasks/{id}",
* tags={"Task"},
* summary="Task Show API",
* security={{"bearerAuth":{}}},
* @OA\Parameter(name="id",in="path",description="id",@OA\Schema(type="integer")),
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TaskResource")
* )
* ),
* )
*
* @OA\Delete (
* path="/api/tasks/{id}",
* tags={"Task"},
* summary="Task Show API",
* security={{"bearerAuth":{}}},
* @OA\Parameter(name="id",in="path",description="id",@OA\Schema(type="integer")),
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TaskResource")
* )
* ),
* )
*
*
* @OA\Post(
* path="/api/tasks/{id}/complete",
* tags={"Task"},
* summary="Complete Task API",
* security={{"bearerAuth":{}}},
* @OA\Parameter(name="id",in="path",description="id",@OA\Schema(type="integer")),
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TaskResource")
* )
* ),
* )
*
*
* @OA\Get(
* path="/api/tasks",
* tags={"Task"},
* summary="list Task API",
* security={{"bearerAuth":{}}},
* @OA\Response(response=200, description="Success",
* @OA\MediaType(mediaType="application/json",
* @OA\Schema(type="object",ref="#/components/schemas/TasksResource")
* )
* ),
* )
*
*/

class Task
{

}
269 changes: 269 additions & 0 deletions storage/api-docs/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,223 @@
}
]
}
},
"/api/tasks": {
"get": {
"tags": [
"Task"
],
"summary": "list Task API",
"operationId": "1d403e6635b90851c520cd710eb619c8",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TasksResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": [
"Task"
],
"summary": "Task Create API",
"operationId": "2d72d39cb4de213bb8d219a472abfb70",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [],
"example": {
"title": "Indoor sports"
}
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TaskResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/tasks/{id}": {
"get": {
"tags": [
"Task"
],
"summary": "Task Show API",
"operationId": "9d2ea5f1c7ed2641039ec9ce7fac1fac",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TaskResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"delete": {
"tags": [
"Task"
],
"summary": "Task Show API",
"operationId": "3203f2e74812d3ed714ff99351646a70",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TaskResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"patch": {
"tags": [
"Task"
],
"summary": "Task Update API",
"operationId": "261489a50c3380bcf2d0916ff401372c",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [],
"example": {
"title": "Indoor sports",
"description": "4*10 Stretching movement"
}
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TaskResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/api/tasks/{id}/complete": {
"post": {
"tags": [
"Task"
],
"summary": "Complete Task API",
"operationId": "aea6d999ec5a03afd7e56ab5bc7b50b7",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TaskResource"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}
}
},
"components": {
Expand Down Expand Up @@ -387,6 +604,58 @@
},
"meta": []
}
},
"TasksResource": {
"type": "object",
"example": {
"messages": [
{
"type": "success",
"text": "responser::response.info"
}
],
"data": [
{
"id": 3,
"user": {
"id": 1,
"name": null,
"email": "[email protected]",
"created_at": "2024-02-22 22:00:13"
},
"title": "Indoor sports",
"description": null,
"completed_at": null,
"created_at": "2024-02-22 22:05:07"
}
],
"meta": []
}
},
"TaskResource": {
"type": "object",
"example": {
"messages": [
{
"type": "success",
"text": "responser::response.info"
}
],
"data": {
"id": 3,
"user": {
"id": 1,
"name": null,
"email": "[email protected]",
"created_at": "2024-02-22 22:00:13"
},
"title": "Indoor sports",
"description": null,
"completed_at": null,
"created_at": "2024-02-22 22:05:07"
},
"meta": []
}
}
},
"securitySchemes": {
Expand Down

0 comments on commit 3f11e2b

Please sign in to comment.