From 8232efdecbb54315a674ab4317b15908cfa34943 Mon Sep 17 00:00:00 2001 From: Irfan Date: Tue, 14 Jul 2020 17:15:45 +0500 Subject: [PATCH] `season` in lowercase --- .env.dist | 5 +- app/Anime.php | 3 +- app/Http/Controllers/V4DB/AnimeController.php | 17 ++ app/Http/Controllers/V4DB/Controller.php | 20 +- app/Http/Resources/V4/AnimeResource.php | 182 +++++++++++++- app/Http/Resources/V4/CommonResource.php | 91 ++++++- bootstrap/app.php | 4 + composer.json | 4 +- composer.lock | 176 +++++++++++++- config/swagger-lume.php | 204 ++++++++++++++++ .../views/vendor/swagger-lume/index.blade.php | 101 ++++++++ storage/api-docs/api-docs.json | 230 ++++++++++++++++++ 12 files changed, 1023 insertions(+), 14 deletions(-) create mode 100644 config/swagger-lume.php create mode 100644 resources/views/vendor/swagger-lume/index.blade.php create mode 100644 storage/api-docs/api-docs.json diff --git a/.env.dist b/.env.dist index 6417069..11247a4 100755 --- a/.env.dist +++ b/.env.dist @@ -115,4 +115,7 @@ SLAVE_KEY_HEADER="X-Master" ### GITHUB_REPORTING=true GITHUB_REST="jikan-me/jikan-rest" -GITHUB_API="jikan-me/jikan \ No newline at end of file +GITHUB_API="jikan-me/jikan + + +SWAGGER_VERSION=3.0 \ No newline at end of file diff --git a/app/Anime.php b/app/Anime.php index db9e739..9cc6225 100644 --- a/app/Anime.php +++ b/app/Anime.php @@ -127,7 +127,8 @@ class Anime extends Model return null; } - return explode(' ', $premiered)[0]; + $season = explode(' ', $premiered)[0]; + return strtolower($season); } public function setYearAttribute($value) diff --git a/app/Http/Controllers/V4DB/AnimeController.php b/app/Http/Controllers/V4DB/AnimeController.php index 7de1a01..b243983 100644 --- a/app/Http/Controllers/V4DB/AnimeController.php +++ b/app/Http/Controllers/V4DB/AnimeController.php @@ -44,6 +44,23 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class AnimeController extends Controller { + /** + * @OA\Get( + * path="/anime/{id}", + * operationId="getAnimeById", + * tags={"anime"}, + * + * @OA\Response( + * response="200", + * description="Returns anime resource", + * @OA\JsonContent() + * ), + * @OA\Response( + * response="400", + * description="Error: Bad request. When required parameters were not supplied.", + * ), + * ) + */ public function main(Request $request, int $id) { $results = Anime::query() diff --git a/app/Http/Controllers/V4DB/Controller.php b/app/Http/Controllers/V4DB/Controller.php index f26bdb0..f1ee6e1 100644 --- a/app/Http/Controllers/V4DB/Controller.php +++ b/app/Http/Controllers/V4DB/Controller.php @@ -4,18 +4,10 @@ namespace App\Http\Controllers\V4DB; use App\Http\HttpHelper; use App\Providers\SerializerFactory; -use App\Providers\SerializerServiceProdivder; -use App\Providers\SerializerServiceProviderV3; -use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Jikan\Jikan; use Jikan\MyAnimeList\MalClient; -use JMS\Serializer\Context; use JMS\Serializer\Serializer; use Laravel\Lumen\Routing\Controller as BaseController; -use mysql_xdevapi\Exception; -use r\Queries\Control\Http; -use Symfony\Component\HttpFoundation\Response; /** * Class Controller @@ -23,6 +15,18 @@ use Symfony\Component\HttpFoundation\Response; */ class Controller extends BaseController { + + /** + * @OA\Info( + * title="Jikan API", + * version="4.0", + * @OA\Contact( + * email="neko@jikan.moe", + * name="Support" + * ) + * ) + */ + /** * @var Serializer */ diff --git a/app/Http/Resources/V4/AnimeResource.php b/app/Http/Resources/V4/AnimeResource.php index 0a1b560..7873add 100644 --- a/app/Http/Resources/V4/AnimeResource.php +++ b/app/Http/Resources/V4/AnimeResource.php @@ -6,6 +6,186 @@ use Illuminate\Http\Resources\Json\JsonResource; class AnimeResource extends JsonResource { + /** + * @OA\Schema( + * schema="anime", + * description="Anime Resource", + * + * @OA\Property( + * property="mal_id", + * type="integer", + * description="MyAnimeList ID" + * ), + * @OA\Property( + * property="url", + * type="string", + * description="MyAnimeList URL" + * ), + * @OA\Property( + * property="images", + * type="object", + * description="Images", + * @OA\Property( + * property="jpg", + * type="object", + * description="Available images in JPG", + * @OA\Property( + * property="image_url", + * type="string", + * description="Image URL JPG (225x335)", + * ), + * @OA\Property( + * property="small_image_url", + * type="string", + * description="Small Image URL JPG (50x74)", + * ), + * @OA\Property( + * property="large_image_url", + * type="string", + * description="Image URL JPG (300x446)", + * ), + * ), + * @OA\Property( + * property="webp", + * type="object", + * description="Available images in WEBP", + * @OA\Property( + * property="image_url", + * type="string", + * description="Image URL WEBP (225x335)", + * ), + * @OA\Property( + * property="small_image_url", + * type="string", + * description="Small Image URL WEBP (50x74)", + * ), + * @OA\Property( + * property="large_image_url", + * type="string", + * description="Image URL WEBP (300x446)", + * ), + * ), + * ), + * @OA\Property( + * property="trailer", + * ref="#/components/schemas/trailer" + * ), + * + * @OA\Property( + * property="title", + * type="string", + * description="Title" + * ), + * @OA\Property( + * property="title_english", + * type="string", + * description="English Title" + * ), + * @OA\Property( + * property="title_japanese", + * type="string", + * description="Japanese Title" + * ), + * @OA\Property( + * property="title_synonyms", + * type="array", + * description="Other Titles", + * @OA\Items( + * type="string" + * ) + * ), + * @OA\Property( + * property="type", + * type="string", + * enum={"TV","OVA","Movie","Special","ONA","Music"}, + * description="Anime Type" + * ), + * @OA\Property( + * property="source", + * type="string", + * description="Original Material/Source adapted from" + * ), + * @OA\Property( + * property="episodes", + * type="integer", + * description="Episode count" + * ), + * @OA\Property( + * property="status", + * type="string", + * enum={"Finished Airing", "Currently Airing", "Not yet aired"}, + * description="Airing status" + * ), + * @OA\Property( + * property="airing", + * type="bool", + * description="Airing boolean" + * ), + * @OA\Property( + * property="aired", + * ref="#/components/schemas/daterange" + * ), + * @OA\Property( + * property="duration", + * type="string", + * description="Parsed raw duration" + * ), + * @OA\Property( + * property="rating", + * type="string", + * enum={"G - All Ages", "PG - Children", "PG-13 - Teens 13 or older", "R - 17+ (violence & profanity)", "R+ - Mild Nudity", "Rx - Hentai" }, + * description="Anime audience rating" + * ), + * @OA\Property( + * property="score", + * type="float", + * description="Score" + * ), + * @OA\Property( + * property="scored_by", + * type="integer", + * description="Number of users" + * ), + * @OA\Property( + * property="rank", + * type="integer", + * description="Ranking" + * ), + * @OA\Property( + * property="popularity", + * type="integer", + * description="Popularity" + * ), + * @OA\Property( + * property="members", + * type="integer", + * description="Number of users who have added this entry to their list" + * ), + * @OA\Property( + * property="favorites", + * type="integer", + * description="Number of users who have favorited this entry" + * ), + * @OA\Property( + * property="synopsis", + * type="string", + * description="Synopsis" + * ), + * @OA\Property( + * property="background", + * type="string", + * description="Background" + * ), + * @OA\Property( + * property="season", + * type="float", + * description="Score" + * ), + + * + * ) + */ + /** * Transform the resource into an array. * @@ -31,7 +211,7 @@ class AnimeResource extends JsonResource 'aired' => $this->aired, 'duration' => $this->duration, 'rating' => $this->rating, - 'scored' => $this->score, + 'score' => $this->score, 'scored_by' => $this->scored_by, 'rank' => $this->rank, 'popularity' => $this->popularity, diff --git a/app/Http/Resources/V4/CommonResource.php b/app/Http/Resources/V4/CommonResource.php index e71746c..6f7702c 100644 --- a/app/Http/Resources/V4/CommonResource.php +++ b/app/Http/Resources/V4/CommonResource.php @@ -6,5 +6,94 @@ use Illuminate\Http\Resources\Json\JsonResource; class CommonResource extends JsonResource { - + /** + * @OA\Schema( + * schema="trailer", + * type="object", + * description="Youtube Details", + * + * @OA\Property( + * property="youtube_id", + * type="string", + * description="YouTube ID" + * ), + * @OA\Property( + * property="url", + * type="string", + * description="YouTube URL" + * ), + * @OA\Property( + * property="embed_url", + * type="string", + * description="Parsed Embed URL" + * ), + * ), + * + * @OA\Schema( + * schema="daterange", + * type="object", + * description="Date range", + * + * @OA\Property( + * property="from", + * type="string", + * description="Date ISO8601" + * ), + * @OA\Property( + * property="to", + * type="string", + * description="Date ISO8601" + * ), + * @OA\Property( + * property="prop", + * type="object", + * description="Date Prop", + * @OA\Property( + * property="from", + * type="object", + * description="Date Prop From", + * @OA\Property( + * property="day", + * type="integer", + * description="Day" + * ), + * @OA\Property( + * property="month", + * type="integer", + * description="Month" + * ), + * @OA\Property( + * property="year", + * type="integer", + * description="year" + * ), + * ), + * @OA\Property( + * property="to", + * type="object", + * description="Date Prop To", + * @OA\Property( + * property="day", + * type="integer", + * description="Day" + * ), + * @OA\Property( + * property="month", + * type="integer", + * description="Month" + * ), + * @OA\Property( + * property="year", + * type="integer", + * description="year" + * ), + * ), + * @OA\Property( + * property="string", + * type="string", + * description="Raw parsed string" + * ), + * ), + * ) + */ } \ No newline at end of file diff --git a/bootstrap/app.php b/bootstrap/app.php index 36350e5..76b19b7 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -37,6 +37,8 @@ $app->register(Jenssegers\Mongodb\MongodbServiceProvider::class); $app->withFacades(); $app->withEloquent(); +$app->configure('swagger-lume'); + /* |-------------------------------------------------------------------------- | Register Container Bindings @@ -99,6 +101,8 @@ $app->configure('queue'); $app->configure('controller-to-table-mapping'); $app->configure('controller'); +$app->register(\SwaggerLume\ServiceProvider::class); + if (env('CACHING')) { $app->configure('cache'); $app->register(Illuminate\Redis\RedisServiceProvider::class); diff --git a/composer.json b/composer.json index 1995458..675c656 100755 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "ext-json": "*", "ext-mongodb": "*", "danielmewes/php-rql": "dev-master", + "darkaonline/swagger-lume": "7", "divineomega/cachetphp": "^0.2.0", "fabpot/goutte": "3.2.3", "flipbox/lumen-generator": "^6", @@ -22,7 +23,8 @@ "predis/predis": "^1.1", "symfony/yaml": "^4.1", "vlucas/phpdotenv": "^4", - "voku/anti-xss": "^4.0" + "voku/anti-xss": "^4.0", + "zircote/swagger-php": "3.*" }, "require-dev": { "fzaninotto/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index 0c4bd67..77aaf94 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "2aa457b1ebc4916d31595557c9a0d095", + "content-hash": "e3247d03ea2c99fbb0f463eb109a8f79", "packages": [ { "name": "brick/math", @@ -164,6 +164,60 @@ ], "time": "2016-05-31T01:55:32+00:00" }, + { + "name": "darkaonline/swagger-lume", + "version": "7.0", + "source": { + "type": "git", + "url": "https://github.com/DarkaOnLine/SwaggerLume.git", + "reference": "f51914718ab6a9b23c66febdef82d26da2f2fad8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DarkaOnLine/SwaggerLume/zipball/f51914718ab6a9b23c66febdef82d26da2f2fad8", + "reference": "f51914718ab6a9b23c66febdef82d26da2f2fad8", + "shasum": "" + }, + "require": { + "laravel/lumen-framework": "~6.0|~7.0", + "php": ">=7.2", + "swagger-api/swagger-ui": "^3.0", + "zircote/swagger-php": "~2.0|3.*" + }, + "require-dev": { + "fzaninotto/faker": "~1.8", + "mockery/mockery": "1.*", + "phpunit/phpunit": "8.*", + "satooshi/php-coveralls": "^2.0", + "vlucas/phpdotenv": "~3.3|~4.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "SwaggerLume\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Darius Matulionis", + "email": "darius@matulionis.lt" + } + ], + "description": "Swagger integration to Lumen 5", + "keywords": [ + "laravel", + "lumen", + "swagger" + ], + "time": "2020-03-26T09:34:03+00:00" + }, { "name": "divineomega/cachetphp", "version": "v0.2", @@ -3687,6 +3741,63 @@ ], "time": "2020-03-29T20:13:32+00:00" }, + { + "name": "swagger-api/swagger-ui", + "version": "v3.28.0", + "source": { + "type": "git", + "url": "https://github.com/swagger-api/swagger-ui.git", + "reference": "3cef22736827b933b0f116e33847a47f7724bd16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/3cef22736827b933b0f116e33847a47f7724bd16", + "reference": "3cef22736827b933b0f116e33847a47f7724bd16", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Anna Bodnia", + "email": "anna.bodnia@gmail.com" + }, + { + "name": "Buu Nguyen", + "email": "buunguyen@gmail.com" + }, + { + "name": "Josh Ponelat", + "email": "jponelat@gmail.com" + }, + { + "name": "Kyle Shockey", + "email": "kyleshockey1@gmail.com" + }, + { + "name": "Robert Barnwell", + "email": "robert@robertismy.name" + }, + { + "name": "Sahar Jafari", + "email": "shr.jafari@gmail.com" + } + ], + "description": " Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.", + "homepage": "http://swagger.io", + "keywords": [ + "api", + "documentation", + "openapi", + "specification", + "swagger", + "ui" + ], + "time": "2020-06-29T12:43:36+00:00" + }, { "name": "symfony/browser-kit", "version": "v4.4.8", @@ -5473,6 +5584,69 @@ "utf8" ], "time": "2020-05-14T00:59:19+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "fa47d62c22c95272625624fbf8109fa46ffac43b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/fa47d62c22c95272625624fbf8109fa46ffac43b", + "reference": "fa47d62c22c95272625624fbf8109fa46ffac43b", + "shasum": "" + }, + "require": { + "doctrine/annotations": "*", + "php": ">=7.2", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "phpunit/phpunit": ">=8", + "squizlabs/php_codesniffer": ">=3.3", + "zendframework/zend-form": "<2.8" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "autoload": { + "psr-4": { + "OpenApi\\": "src" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com", + "homepage": "http://www.zircote.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "http://bfanger.nl" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "time": "2020-05-07T09:10:49+00:00" } ], "packages-dev": [ diff --git a/config/swagger-lume.php b/config/swagger-lume.php new file mode 100644 index 0000000..387d42d --- /dev/null +++ b/config/swagger-lume.php @@ -0,0 +1,204 @@ + [ + /* + |-------------------------------------------------------------------------- + | Edit to set the api's title + |-------------------------------------------------------------------------- + */ + 'title' => 'Swagger Lume API', + ], + + 'routes' => [ + /* + |-------------------------------------------------------------------------- + | Route for accessing api documentation interface + |-------------------------------------------------------------------------- + */ + 'api' => '/api/documentation', + + /* + |-------------------------------------------------------------------------- + | Route for accessing parsed swagger annotations. + |-------------------------------------------------------------------------- + */ + 'docs' => '/docs', + + /* + |-------------------------------------------------------------------------- + | Route for Oauth2 authentication callback. + |-------------------------------------------------------------------------- + */ + 'oauth2_callback' => '/api/oauth2-callback', + + /* + |-------------------------------------------------------------------------- + | Route for serving assets + |-------------------------------------------------------------------------- + */ + 'assets' => '/swagger-ui-assets', + + /* + |-------------------------------------------------------------------------- + | Middleware allows to prevent unexpected access to API documentation + |-------------------------------------------------------------------------- + */ + 'middleware' => [ + 'api' => [], + 'asset' => [], + 'docs' => [], + 'oauth2_callback' => [], + ], + ], + + 'paths' => [ + /* + |-------------------------------------------------------------------------- + | Absolute path to location where parsed swagger annotations will be stored + |-------------------------------------------------------------------------- + */ + 'docs' => storage_path('api-docs'), + + /* + |-------------------------------------------------------------------------- + | File name of the generated json documentation file + |-------------------------------------------------------------------------- + */ + 'docs_json' => 'api-docs.json', + + /* + |-------------------------------------------------------------------------- + | Absolute path to directory containing the swagger annotations are stored. + |-------------------------------------------------------------------------- + */ + 'annotations' => base_path('app'), + + /* + |-------------------------------------------------------------------------- + | Absolute path to directories that you would like to exclude from swagger generation + |-------------------------------------------------------------------------- + */ + 'excludes' => [], + + /* + |-------------------------------------------------------------------------- + | Edit to set the swagger scan base path + |-------------------------------------------------------------------------- + */ + 'base' => env('L5_SWAGGER_BASE_PATH', null), + + /* + |-------------------------------------------------------------------------- + | Absolute path to directory where to export views + |-------------------------------------------------------------------------- + */ + 'views' => base_path('resources/views/vendor/swagger-lume'), + ], + + /* + |-------------------------------------------------------------------------- + | API security definitions. Will be generated into documentation file. + |-------------------------------------------------------------------------- + */ + 'security' => [ + /* + |-------------------------------------------------------------------------- + | Examples of Security definitions + |-------------------------------------------------------------------------- + */ + /* + 'api_key_security_example' => [ // Unique name of security + 'type' => 'apiKey', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'A short description for security scheme', + 'name' => 'api_key', // The name of the header or query parameter to be used. + 'in' => 'header', // The location of the API key. Valid values are "query" or "header". + ], + 'oauth2_security_example' => [ // Unique name of security + 'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'A short description for oauth2 security scheme.', + 'flow' => 'implicit', // The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". + 'authorizationUrl' => 'http://example.com/auth', // The authorization URL to be used for (implicit/accessCode) + //'tokenUrl' => 'http://example.com/auth' // The authorization URL to be used for (password/application/accessCode) + 'scopes' => [ + 'read:projects' => 'read your projects', + 'write:projects' => 'modify projects in your account', + ] + ],*/ + + /* Open API 3.0 support + 'passport' => [ // Unique name of security + 'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'Laravel passport oauth2 security.', + 'in' => 'header', + 'scheme' => 'https', + 'flows' => [ + "password" => [ + "authorizationUrl" => config('app.url') . '/oauth/authorize', + "tokenUrl" => config('app.url') . '/oauth/token', + "refreshUrl" => config('app.url') . '/token/refresh', + "scopes" => [] + ], + ], + ], + */ + ], + + /* + |-------------------------------------------------------------------------- + | Turn this off to remove swagger generation on production + |-------------------------------------------------------------------------- + */ + 'generate_always' => env('SWAGGER_GENERATE_ALWAYS', false), + + /* + |-------------------------------------------------------------------------- + | Edit to set the swagger version number + |-------------------------------------------------------------------------- + */ + 'swagger_version' => env('SWAGGER_VERSION', '3.0'), + + /* + |-------------------------------------------------------------------------- + | Edit to trust the proxy's ip address - needed for AWS Load Balancer + |-------------------------------------------------------------------------- + */ + 'proxy' => false, + + /* + |-------------------------------------------------------------------------- + | Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle. + | See more at: https://github.com/swagger-api/swagger-ui#configs-plugin + |-------------------------------------------------------------------------- + */ + + 'additional_config_url' => null, + + /* + |-------------------------------------------------------------------------- + | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), + | 'method' (sort by HTTP method). + | Default is the order returned by the server unchanged. + |-------------------------------------------------------------------------- + */ + + 'operations_sort' => env('L5_SWAGGER_OPERATIONS_SORT', null), + + /* + |-------------------------------------------------------------------------- + | Uncomment to pass the validatorUrl parameter to SwaggerUi init on the JS + | side. A null value here disables validation. + |-------------------------------------------------------------------------- + */ + + 'validator_url' => null, + + /* + |-------------------------------------------------------------------------- + | Uncomment to add constants which can be used in anotations + |-------------------------------------------------------------------------- + */ + 'constants' => [ + // 'SWAGGER_LUME_CONST_HOST' => env('SWAGGER_LUME_CONST_HOST', 'http://my-default-host.com'), + ], +]; diff --git a/resources/views/vendor/swagger-lume/index.blade.php b/resources/views/vendor/swagger-lume/index.blade.php new file mode 100644 index 0000000..a984948 --- /dev/null +++ b/resources/views/vendor/swagger-lume/index.blade.php @@ -0,0 +1,101 @@ + + + + + + {{config('swagger-lume.api.title')}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/storage/api-docs/api-docs.json b/storage/api-docs/api-docs.json new file mode 100644 index 0000000..629b480 --- /dev/null +++ b/storage/api-docs/api-docs.json @@ -0,0 +1,230 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Jikan API", + "contact": { + "name": "Support", + "email": "neko@jikan.moe" + }, + "version": "4.0" + }, + "paths": { + "/anime/{id}": { + "get": { + "tags": [ + "anime" + ], + "operationId": "getAnimeById", + "responses": { + "200": { + "description": "Returns anime resource", + "content": { + "application/json": { + "schema": {} + } + } + }, + "400": { + "description": "Error: Bad request. When required parameters were not supplied." + } + } + } + } + }, + "components": { + "schemas": { + "anime": { + "description": "Anime Resource", + "properties": { + "mal_id": { + "description": "MyAnimeList ID", + "type": "integer" + }, + "url": { + "description": "MyAnimeList URL", + "type": "string" + }, + "images": { + "description": "Images", + "properties": { + "jpg": { + "description": "Available images in JPG", + "properties": { + "image_url": { + "description": "Image URL JPG (225x335)", + "type": "string" + }, + "small_image_url": { + "description": "Small Image URL JPG (50x74)", + "type": "string" + }, + "large_image_url": { + "description": "Image URL JPG (300x446)", + "type": "string" + } + }, + "type": "object" + }, + "webp": { + "description": "Available images in WEBP", + "properties": { + "image_url": { + "description": "Image URL WEBP (225x335)", + "type": "string" + }, + "small_image_url": { + "description": "Small Image URL WEBP (50x74)", + "type": "string" + }, + "large_image_url": { + "description": "Image URL WEBP (300x446)", + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "trailer": { + "$ref": "#/components/schemas/trailer" + }, + "title": { + "description": "Title", + "type": "string" + }, + "title_english": { + "description": "English Title", + "type": "string" + }, + "title_japanese": { + "description": "Japanese Title", + "type": "string" + }, + "title_synonyms": { + "description": "Other Titles", + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "description": "Anime Type", + "type": "string", + "enum": [ + "TV", + "OVA", + "Movie", + "Special", + "ONA", + "Music" + ] + }, + "source": { + "description": "Original Material/Source adapted from", + "type": "string" + }, + "episodes": { + "description": "Episode count", + "type": "integer" + }, + "status": { + "description": "Airing status", + "type": "string", + "enum": [ + "Finished Airing", + "Currently Airing", + "Not yet aired" + ] + }, + "airing": { + "description": "Airing boolean", + "type": "bool" + }, + "aired": { + "$ref": "#/components/schemas/daterange" + } + }, + "type": "object" + }, + "trailer": { + "description": "Youtube Details", + "properties": { + "youtube_id": { + "description": "YouTube ID", + "type": "string" + }, + "url": { + "description": "YouTube URL", + "type": "string" + }, + "embed_url": { + "description": "Parsed Embed URL", + "type": "string" + } + }, + "type": "object" + }, + "daterange": { + "description": "Date range", + "properties": { + "from": { + "description": "Date ISO8601", + "type": "string" + }, + "to": { + "description": "Date ISO8601", + "type": "string" + }, + "prop": { + "description": "Date Prop", + "properties": { + "from": { + "description": "Date Prop From", + "properties": { + "day": { + "description": "Day", + "type": "integer" + }, + "month": { + "description": "Month", + "type": "integer" + }, + "year": { + "description": "year", + "type": "integer" + } + }, + "type": "object" + }, + "to": { + "description": "Date Prop To", + "properties": { + "day": { + "description": "Day", + "type": "integer" + }, + "month": { + "description": "Month", + "type": "integer" + }, + "year": { + "description": "year", + "type": "integer" + } + }, + "type": "object" + }, + "string": { + "description": "Raw parsed string", + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } +} \ No newline at end of file