From 108aa22387eb54c56eface862f3a852e7bb0a931 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 27 May 2022 12:17:06 +1000 Subject: [PATCH] Fixes for openAPI schema --- .../OpenAPI/TaskSchedulerSchema.php | 4 +- .../Controllers/TaskSchedulerController.php | 53 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/OpenAPI/TaskSchedulerSchema.php b/app/Http/Controllers/OpenAPI/TaskSchedulerSchema.php index 7976fd4755..ead95fc277 100644 --- a/app/Http/Controllers/OpenAPI/TaskSchedulerSchema.php +++ b/app/Http/Controllers/OpenAPI/TaskSchedulerSchema.php @@ -7,7 +7,7 @@ * type="object", * * - * @OA\Property(property="paused",type="bool",example="false",description="The scheduler paused state"), + * @OA\Property(property="paused",type="boolean",example="false",description="The scheduler paused state"), * @OA\Property(property="repeat_every",type="string",example="DAY",description="Accepted values (DAY,WEEK,MONTH,3MONTHS,YEAR)"), * @OA\Property(property="start_from",type="integer",example="1652898504",description="Timestamp when we should start the scheduler, default is today"), * @OA\Property(property="date_range", type="string", example="last7", description="The string representation of the date range of data to be returned"), @@ -33,7 +33,7 @@ * schema="UpdateTaskSchedulerSchema", * type="object", * - * @OA\Property(property="paused",type="bool",example="false",description="The scheduler paused state"), + * @OA\Property(property="paused",type="boolean",example="false",description="The scheduler paused state"), * * @OA\Property(property="repeat_every",type="string",example="DAY",description="Accepted values (DAY,WEEK,MONTH,3MONTHS,YEAR)"), * @OA\Property(property="start_from",type="integer",example="1652898504",description="Timestamp when we should start the scheduler, default is today"), * diff --git a/app/Http/Controllers/TaskSchedulerController.php b/app/Http/Controllers/TaskSchedulerController.php index 7867137df9..97652e7e61 100644 --- a/app/Http/Controllers/TaskSchedulerController.php +++ b/app/Http/Controllers/TaskSchedulerController.php @@ -114,13 +114,24 @@ class TaskSchedulerController extends BaseController /** * @OA\GET( - * path="/api/v1/task_scheduler/{scheduler}", + * path="/api/v1/task_scheduler/{id}", * operationId="showTaskScheduler", * tags={"task_scheduler"}, * summary="Show given scheduler", * description="Get scheduler with associated job", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Scheduler Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), * @OA\Response( * response=200, * description="success", @@ -143,14 +154,24 @@ class TaskSchedulerController extends BaseController /** * @OA\PUT( - * path="/api/v1/task_scheduler/{scheduler}", + * path="/api/v1/task_scheduler/{id}", * operationId="updateTaskScheduler", * tags={"task_scheduler"}, * summary="Update task scheduler ", * description="Update task scheduler", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\RequestBody( + * @OA\Parameter( + * name="id", + * in="path", + * description="The Scheduler Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), * @OA\RequestBody( * required=true, * @OA\JsonContent(ref="#/components/schemas/UpdateTaskSchedulerSchema") * ), @@ -181,13 +202,24 @@ class TaskSchedulerController extends BaseController /** * @OA\PUT( - * path="/api/v1/task_scheduler/{scheduler}/update_job/", + * path="/api/v1/task_scheduler/{id}/update_job/", * operationId="updateTaskSchedulerJob", * tags={"task_scheduler"}, * summary="Update job for a task scheduler ", * description="Update job for a task scheduler | if we are changing action for a job, we should send the request for a new job same as we are creating new scheduler", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Scheduler Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), * @OA\RequestBody( * required=true, * @OA\JsonContent(ref="#/components/schemas/UpdateJobForASchedulerSchema") @@ -219,13 +251,24 @@ class TaskSchedulerController extends BaseController /** * @OA\DELETE( - * path="/api/v1/task_scheduler/{scheduler}", + * path="/api/v1/task_scheduler/{id}", * operationId="destroyTaskScheduler", * tags={"task_scheduler"}, * summary="Destroy Task Scheduler", * description="Destroy task scheduler and its associated job", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Scheduler Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), * @OA\Response( * response=200, * description="success",