finalize Anime/Manga Reviews, User Reviews, Top Reviews Schema

This commit is contained in:
Irfan 2020-08-01 13:02:44 +05:00
parent 8e65634227
commit 4ecd642f2d
8 changed files with 826 additions and 233 deletions

View File

@ -22,7 +22,40 @@ class ReviewsController extends Controller
* @OA\Response(
* response="200",
* description="Returns recent anime reviews",
* @OA\JsonContent()
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/anime review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* }
* )
* ),
* )
* }
* )
* )
* ),
* @OA\Response(
* response="400",
@ -95,7 +128,40 @@ class ReviewsController extends Controller
* @OA\Response(
* response="200",
* description="Returns recent manga reviews",
* @OA\JsonContent()
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* allOf={
* @OA\Schema(ref="#/components/schemas/manga review"),
* @OA\Schema(
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* }
* )
* ),
* )
* }
* )
* )
* ),
* @OA\Response(
* response="400",

View File

@ -244,7 +244,63 @@ class TopController extends Controller
* @OA\Response(
* response="200",
* description="Returns top reviews",
* @OA\JsonContent()
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* anyOf={
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#/components/schemas/anime review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* },
* ),
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#/components/schemas/manga review"),
* @OA\Schema(
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* },
* ),
* },
* ),
* ),
* )
* }
* )
* ),
* ),
* @OA\Response(
* response="400",

View File

@ -359,7 +359,63 @@ class UserController extends Controller
* @OA\Response(
* response="200",
* description="Returns user reviews",
* @OA\JsonContent()
* @OA\JsonContent(
* @OA\Property(
* property="data",
* allOf={
* @OA\Schema(ref="#/components/schemas/pagination"),
* @OA\Schema(
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(
* anyOf={
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#/components/schemas/anime review"),
* @OA\Schema(
* @OA\Property(
* property="anime",
* type="object",
* ref="#/components/schemas/anime meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* },
* ),
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#/components/schemas/manga review"),
* @OA\Schema(
* @OA\Property(
* property="manga",
* type="object",
* ref="#/components/schemas/manga meta",
* ),
* ),
* @OA\Schema(
* @OA\Property(
* property="user",
* type="object",
* ref="#/components/schemas/user meta",
* ),
* ),
* },
* ),
* },
* ),
* ),
* )
* }
* )
* ),
* ),
* @OA\Response(
* response="400",

View File

@ -323,6 +323,181 @@ class CommonResource extends JsonResource
* ),
*
* @OA\Schema(
* schema="user meta",
* type="object",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList Profile URL"
* ),
* @OA\Property(
* property="images",
* type="object",
* ref="#/components/schemas/user images",
* ),
* ),
*
* @OA\Schema(
* schema="user images",
* type="object",
* @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="webp",
* type="object",
* description="Available images in WEBP",
* @OA\Property(
* property="image_url",
* type="string",
* description="Image URL WEBP (225x335)",
* ),
* ),
* ),
*
* @OA\Schema(
* schema="anime meta",
* type="object",
* @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",
* ref="#/components/schemas/anime images",
* ),
* ),
*
* @OA\Schema(
* schema="manga meta",
* type="object",
* @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",
* ref="#/components/schemas/manga images",
* ),
* ),
*
* @OA\Schema(
* schema="anime images",
* type="object",
* @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\Schema(
* schema="manga images",
* type="object",
* @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\Schema(
* schema="anime review",
* type="object",
* @OA\Property(
@ -390,66 +565,6 @@ class CommonResource extends JsonResource
* type="string",
* description="Review content"
* ),
* @OA\Property(
* property="author",
* type="object",
* description="Reviewer details",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList Profile URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="User Display Picture Image URL"
* ),
* @OA\Property(
* property="episodes_seen",
* type="integer",
* description="Number of episodes seen"
* ),
* @OA\Property(
* property="scores",
* type="object",
* description="Review Scores breakdown",
* @OA\Property(
* property="overall",
* type="integer",
* description="Overall Score"
* ),
* @OA\Property(
* property="story",
* type="integer",
* description="Story Score"
* ),
* @OA\Property(
* property="animation",
* type="integer",
* description="Animation Score"
* ),
* @OA\Property(
* property="sound",
* type="integer",
* description="Sound Score"
* ),
* @OA\Property(
* property="character",
* type="integer",
* description="Character Score"
* ),
* @OA\Property(
* property="enjoyment",
* type="integer",
* description="Enjoyment Score"
* ),
* ),
* ),
* ),
*
* @OA\Schema(
@ -515,61 +630,6 @@ class CommonResource extends JsonResource
* type="string",
* description="Review content"
* ),
* @OA\Property(
* property="reviewer",
* type="object",
* description="Reviewer details",
* @OA\Property(
* property="username",
* type="string",
* description="MyAnimeList Username"
* ),
* @OA\Property(
* property="url",
* type="string",
* description="MyAnimeList Profile URL"
* ),
* @OA\Property(
* property="image_url",
* type="string",
* description="User Display Picture Image URL"
* ),
* @OA\Property(
* property="chapters_read",
* type="integer",
* description="Number of chapters read"
* ),
* @OA\Property(
* property="scores",
* type="object",
* description="Review Scores breakdown",
* @OA\Property(
* property="overall",
* type="integer",
* description="Overall Score"
* ),
* @OA\Property(
* property="story",
* type="integer",
* description="Story Score"
* ),
* @OA\Property(
* property="art",
* type="integer",
* description="Animation Score"
* ),
* @OA\Property(
* property="character",
* type="integer",
* description="Character Score"
* ),
* @OA\Property(
* property="enjoyment",
* type="integer",
* description="Enjoyment Score"
* ),
* ),
* ),
* ),
*/
}

View File

@ -13,7 +13,7 @@ class ProfileHistoryResource extends JsonResource
* @return array
*
* @OA\Schema(
* schema="users",
* schema="users history",
* type="object",
*
* @OA\Property(

View File

@ -15,7 +15,7 @@
"flipbox/lumen-generator": "^6",
"illuminate/redis": "^7",
"jenssegers/mongodb": "^4.0",
"jikan-me/jikan": "v3.0.0-alpha.20",
"jikan-me/jikan": "v3.0.0-alpha.21",
"jms/serializer": "^1.13",
"laravel/lumen-framework": "^7.0",
"league/flysystem": "^1.0",

12
composer.lock generated
View File

@ -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": "1a0412ef9aec2190034eee9e72f52d6e",
"content-hash": "31b20ce2b4d0743c4dd7b564d06f33b8",
"packages": [
{
"name": "brick/math",
@ -2264,16 +2264,16 @@
},
{
"name": "jikan-me/jikan",
"version": "v3.0.0-alpha.20",
"version": "v3.0.0-alpha.21",
"source": {
"type": "git",
"url": "https://github.com/jikan-me/jikan.git",
"reference": "dae158cfb6aa23324aa8b4660b35d21254c69db7"
"reference": "732dcbfddfca790b1b64c8c3d064842682f318bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jikan-me/jikan/zipball/dae158cfb6aa23324aa8b4660b35d21254c69db7",
"reference": "dae158cfb6aa23324aa8b4660b35d21254c69db7",
"url": "https://api.github.com/repos/jikan-me/jikan/zipball/732dcbfddfca790b1b64c8c3d064842682f318bb",
"reference": "732dcbfddfca790b1b64c8c3d064842682f318bb",
"shasum": ""
},
"require": {
@ -2311,7 +2311,7 @@
}
],
"description": "Jikan is an unofficial MyAnimeList API",
"time": "2020-07-22T21:53:39+00:00"
"time": "2020-08-01T07:05:45+00:00"
},
{
"name": "jms/metadata",

View File

@ -813,6 +813,69 @@
}
}
},
"/people/{id}/anime": {
"get": {
"tags": [
"people"
],
"operationId": "getPersonAnime",
"responses": {
"200": {
"description": "Returns person's anime staff positions",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Error: Bad request. When required parameters were not supplied."
}
}
}
},
"/people/{id}/voices": {
"get": {
"tags": [
"people"
],
"operationId": "getPersonVoices",
"responses": {
"200": {
"description": "Returns person's voice acting roles",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Error: Bad request. When required parameters were not supplied."
}
}
}
},
"/people/{id}/manga": {
"get": {
"tags": [
"people"
],
"operationId": "getPersonManga",
"responses": {
"200": {
"description": "Returns person's published manga",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Error: Bad request. When required parameters were not supplied."
}
}
}
},
"/people/{id}/pictures": {
"get": {
"tags": [
@ -1013,7 +1076,51 @@
"description": "Returns recent anime reviews",
"content": {
"application/json": {
"schema": {}
"schema": {
"properties": {
"data": {
"allOf": [
{
"$ref": "#/components/schemas/pagination"
},
{
"properties": {
"data": {
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/components/schemas/anime review"
},
{
"properties": {
"anime": {
"type": "object",
"$ref": "#/components/schemas/anime meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
}
}
},
"type": "object"
}
]
}
},
"type": "object"
}
}
}
},
@ -1034,7 +1141,51 @@
"description": "Returns recent manga reviews",
"content": {
"application/json": {
"schema": {}
"schema": {
"properties": {
"data": {
"allOf": [
{
"$ref": "#/components/schemas/pagination"
},
{
"properties": {
"data": {
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/components/schemas/manga review"
},
{
"properties": {
"manga": {
"type": "object",
"$ref": "#/components/schemas/manga meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
}
}
},
"type": "object"
}
]
}
},
"type": "object"
}
}
}
},
@ -1374,7 +1525,80 @@
"description": "Returns top reviews",
"content": {
"application/json": {
"schema": {}
"schema": {
"properties": {
"data": {
"allOf": [
{
"$ref": "#/components/schemas/pagination"
},
{
"properties": {
"data": {
"type": "array",
"items": {
"anyOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/anime review"
},
{
"properties": {
"anime": {
"type": "object",
"$ref": "#/components/schemas/anime meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
},
{
"allOf": [
{
"$ref": "#/components/schemas/manga review"
},
{
"properties": {
"manga": {
"type": "object",
"$ref": "#/components/schemas/manga meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
}
]
}
}
},
"type": "object"
}
]
}
},
"type": "object"
}
}
}
},
@ -1458,7 +1682,80 @@
"description": "Returns user reviews",
"content": {
"application/json": {
"schema": {}
"schema": {
"properties": {
"data": {
"allOf": [
{
"$ref": "#/components/schemas/pagination"
},
{
"properties": {
"data": {
"type": "array",
"items": {
"anyOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/anime review"
},
{
"properties": {
"anime": {
"type": "object",
"$ref": "#/components/schemas/anime meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
},
{
"allOf": [
{
"$ref": "#/components/schemas/manga review"
},
{
"properties": {
"manga": {
"type": "object",
"$ref": "#/components/schemas/manga meta"
}
},
"type": "object"
},
{
"properties": {
"user": {
"type": "object",
"$ref": "#/components/schemas/user meta"
}
},
"type": "object"
}
]
}
]
}
}
},
"type": "object"
}
]
}
},
"type": "object"
}
}
}
},
@ -1927,7 +2224,7 @@
}
]
},
"user by id": {
"users": {
"description": "User Meta By ID",
"properties": {
"data": {
@ -3327,6 +3624,164 @@
},
"type": "object"
},
"user meta": {
"properties": {
"username": {
"description": "MyAnimeList Username",
"type": "string"
},
"url": {
"description": "MyAnimeList Profile URL",
"type": "string"
},
"images": {
"type": "object",
"$ref": "#/components/schemas/user images"
}
},
"type": "object"
},
"user images": {
"properties": {
"jpg": {
"description": "Available images in JPG",
"properties": {
"image_url": {
"description": "Image URL JPG (225x335)",
"type": "string"
}
},
"type": "object"
},
"webp": {
"description": "Available images in WEBP",
"properties": {
"image_url": {
"description": "Image URL WEBP (225x335)",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"anime meta": {
"properties": {
"mal_id": {
"description": "MyAnimeList ID",
"type": "integer"
},
"url": {
"description": "MyAnimeList URL",
"type": "string"
},
"images": {
"type": "object",
"$ref": "#/components/schemas/anime images"
}
},
"type": "object"
},
"manga meta": {
"properties": {
"mal_id": {
"description": "MyAnimeList ID",
"type": "integer"
},
"url": {
"description": "MyAnimeList URL",
"type": "string"
},
"images": {
"type": "object",
"$ref": "#/components/schemas/manga images"
}
},
"type": "object"
},
"anime 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"
},
"manga 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"
},
"anime review": {
"properties": {
"mal_id": {
@ -3382,58 +3837,6 @@
"review": {
"description": "Review content",
"type": "string"
},
"author": {
"description": "Reviewer details",
"properties": {
"username": {
"description": "MyAnimeList Username",
"type": "string"
},
"url": {
"description": "MyAnimeList Profile URL",
"type": "string"
},
"image_url": {
"description": "User Display Picture Image URL",
"type": "string"
},
"episodes_seen": {
"description": "Number of episodes seen",
"type": "integer"
},
"scores": {
"description": "Review Scores breakdown",
"properties": {
"overall": {
"description": "Overall Score",
"type": "integer"
},
"story": {
"description": "Story Score",
"type": "integer"
},
"animation": {
"description": "Animation Score",
"type": "integer"
},
"sound": {
"description": "Sound Score",
"type": "integer"
},
"character": {
"description": "Character Score",
"type": "integer"
},
"enjoyment": {
"description": "Enjoyment Score",
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
@ -3489,54 +3892,6 @@
"review": {
"description": "Review content",
"type": "string"
},
"reviewer": {
"description": "Reviewer details",
"properties": {
"username": {
"description": "MyAnimeList Username",
"type": "string"
},
"url": {
"description": "MyAnimeList Profile URL",
"type": "string"
},
"image_url": {
"description": "User Display Picture Image URL",
"type": "string"
},
"chapters_read": {
"description": "Number of chapters read",
"type": "integer"
},
"scores": {
"description": "Review Scores breakdown",
"properties": {
"overall": {
"description": "Overall Score",
"type": "integer"
},
"story": {
"description": "Story Score",
"type": "integer"
},
"art": {
"description": "Animation Score",
"type": "integer"
},
"character": {
"description": "Character Score",
"type": "integer"
},
"enjoyment": {
"description": "Enjoyment Score",
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
@ -4213,7 +4568,7 @@
},
"type": "object"
},
"user": {
"users history": {
"properties": {
"data": {
"description": "Transform the resource into an array.",