move open api docs params to respective DTO files

This commit is contained in:
Irfan 2023-04-27 13:38:00 +05:00 committed by pushrbx
parent 55229901ab
commit ec5f091687
7 changed files with 59 additions and 53 deletions

View File

@ -3,10 +3,20 @@
namespace App\Dto\Concerns;
use App\Casts\ContextualBooleanCast;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\BooleanType;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Optional;
/**
* @OA\Parameter(
* name="kids",
* in="query",
* required=false,
* description="This is a flag. When supplied it will include entries with the Kids genres in specific endpoints that filter them out by default. You do not need to pass a value to it. e.g usage: `?kids`",
* @OA\Schema(type="boolean")
* ),
*/
trait HasKidsParameter
{
use PreparesData;

View File

@ -3,10 +3,19 @@
namespace App\Dto\Concerns;
use App\Rules\Attributes\MaxLimitWithFallback;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\IntegerType;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Optional;
/**
* @OA\Parameter(
* name="limit",
* in="query",
* @OA\Schema(type="integer")
* ),
*/
trait HasLimitParameter
{
use PreparesData;

View File

@ -2,10 +2,18 @@
namespace App\Dto\Concerns;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\Validation\Numeric;
use Spatie\LaravelData\Optional;
/**
* @OA\Parameter(
* name="page",
* in="query",
* @OA\Schema(type="integer")
* ),
*/
trait HasPageParameter
{
#[Numeric, Min(1)]

View File

@ -3,10 +3,20 @@
namespace App\Dto\Concerns;
use App\Casts\ContextualBooleanCast;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\BooleanType;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Optional;
/**
* @OA\Parameter(
* name="sfw",
* in="query",
* required=false,
* description="'Safe For Work'. This is a flag. When supplied it will filter out entries according to the SFW Policy. You do not need to pass a value to it. e.g usage: `?sfw`",
* @OA\Schema(type="boolean")
* ),
*/
trait HasSfwParameter
{
use PreparesData;

View File

@ -3,10 +3,20 @@
namespace App\Dto\Concerns;
use App\Casts\ContextualBooleanCast;
use OpenApi\Annotations as OA;
use Spatie\LaravelData\Attributes\Validation\BooleanType;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Optional;
/**
* @OA\Parameter(
* name="unapproved",
* in="query",
* required=false,
* description="This is a flag. When supplied it will include entries which are unapproved. Unapproved entries on MyAnimeList are those that are user submitted and have not yet been approved by MAL to show up on other pages. They will have their own specifc pages and are often removed resulting in a 404 error. You do not need to pass a value to it. e.g usage: `?unapproved`",
* @OA\Schema(type="boolean")
* ),
*/
trait HasUnapprovedParameter
{
use PreparesData;

View File

@ -48,47 +48,6 @@ class Controller extends BaseController
* )
*/
/**
* Common parameters
*
* @OA\Parameter(
* name="page",
* in="query",
* @OA\Schema(type="integer")
* ),
*
* @OA\Parameter(
* name="limit",
* in="query",
* @OA\Schema(type="integer")
* ),
*
* @OA\Parameter(
* name="sfw",
* in="query",
* required=false,
* description="'Safe For Work'. This is a flag. When supplied it will filter out entries according to the SFW Policy. You do not need to pass a value to it. e.g usage: `?sfw`",
* @OA\Schema(type="boolean")
* ),
*
* @OA\Parameter(
* name="kids",
* in="query",
* required=false,
* description="This is a flag. When supplied it will include entries with the Kids genres in specific endpoints that filter them out by default. You do not need to pass a value to it. e.g usage: `?kids`",
* @OA\Schema(type="boolean")
* ),
*
* @OA\Parameter(
* name="unapproved",
* in="query",
* required=false,
* description="This is a flag. When supplied it will include entries which are unapproved. Unapproved entries on MyAnimeList are those that are user submitted and have not yet been approved by MAL to show up on other pages. They will have their own specifc pages and are often removed resulting in a 404 error. You do not need to pass a value to it. e.g usage: `?unapproved`",
* @OA\Schema(type="boolean")
* ),
*/
/**
* @var Request
*/

View File

@ -8999,11 +8999,13 @@
}
},
"parameters": {
"page": {
"name": "page",
"kids": {
"name": "kids",
"in": "query",
"description": "This is a flag. When supplied it will include entries with the Kids genres in specific endpoints that filter them out by default. You do not need to pass a value to it. e.g usage: `?kids`",
"required": false,
"schema": {
"type": "integer"
"type": "boolean"
}
},
"limit": {
@ -9013,6 +9015,13 @@
"type": "integer"
}
},
"page": {
"name": "page",
"in": "query",
"schema": {
"type": "integer"
}
},
"sfw": {
"name": "sfw",
"in": "query",
@ -9022,15 +9031,6 @@
"type": "boolean"
}
},
"kids": {
"name": "kids",
"in": "query",
"description": "This is a flag. When supplied it will include entries with the Kids genres in specific endpoints that filter them out by default. You do not need to pass a value to it. e.g usage: `?kids`",
"required": false,
"schema": {
"type": "boolean"
}
},
"unapproved": {
"name": "unapproved",
"in": "query",