Fix OpenAPI schema

Fixes #239
This commit is contained in:
László GÖRÖG 2022-06-10 17:52:40 +02:00
parent 6db9ca70c1
commit 85f8797602
4 changed files with 152 additions and 173 deletions

3
.gitignore vendored
View File

@ -6,8 +6,9 @@ Homestead.yaml
composer.phar
composer.lock
.php_cs.cache
.phpunit.result.cache
.env.v4
/storage/app/indexer
/storage/app/failovers.json
/storage/app/source_failover_last_downtime
/storage/app/source_failover.lock
/storage/app/source_failover.lock

View File

@ -2,13 +2,8 @@
namespace App\Http\Controllers\V4DB;
use App\Anime;
use App\Http\HttpHelper;
use App\Http\HttpResponse;
use App\Http\QueryBuilder\UserListQueryBuilder;
use App\Http\Resources\V4\AnimeCharactersResource;
use App\Http\Resources\V4\CommonResource;
use App\Http\Resources\V4\ProfileFriendsResource;
use App\Http\Resources\V4\ProfileHistoryResource;
use App\Http\Resources\V4\ResultsResource;
use App\Http\Resources\V4\UserProfileAnimeListCollection;
@ -16,17 +11,14 @@ use App\Http\Resources\V4\UserProfileAnimeListResource;
use App\Http\Resources\V4\UserProfileMangaListCollection;
use App\Http\Resources\V4\UserProfileMangaListResource;
use App\Profile;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Jikan\Request\Anime\AnimeCharactersAndStaffRequest;
use Jikan\Request\User\RecentlyOnlineUsersRequest;
use Jikan\Request\User\UserAnimeListRequest;
use Jikan\Request\User\UserClubsRequest;
use Jikan\Request\User\UserMangaListRequest;
use Jikan\Request\User\UserProfileRequest;
use Jikan\Request\User\UserFriendsRequest;
use Jikan\Request\User\UserHistoryRequest;
use Jikan\Request\User\UserMangaListRequest;
use Jikan\Request\User\UserRecommendationsRequest;
use Jikan\Request\User\UserReviewsRequest;
use MongoDB\BSON\UTCDateTime;
@ -308,8 +300,11 @@ class UserController extends Controller
* response="200",
* description="Returns user favorites",
* @OA\JsonContent(
* ref="#/components/schemas/user_favorites"
* )
* @OA\Property(
* property="data",
* ref="#/components/schemas/user_favorites"
* ),
* ),
* ),
* @OA\Response(
* response="400",

View File

@ -16,93 +16,82 @@ class ProfileFavoritesResource extends JsonResource
* schema="user_favorites",
* type="object",
*
* @OA\Property (
* property="anime",
* type="array",
* description="Favorite Anime",
*
* @OA\Items (
* type="object",
*
* allOf={
* @OA\Schema (ref="#/components/schemas/anime_meta"),
* @OA\Schema (
* @OA\Property (
* property="type",
* type="string"
* ),
* @OA\Property (
* property="start_year",
* type="integer"
* ),
* ),
* },
* ),
* ),
* @OA\Property(
* property="data",
* type="object",
* description="Favorite entries",
* property="manga",
* type="array",
* description="Favorite Manga",
*
* @OA\Property (
* property="anime",
* type="array",
* description="Favorite Anime",
* @OA\Items (
* type="object",
* allOf={
* @OA\Schema (ref="#/components/schemas/manga_meta"),
* @OA\Schema (
* @OA\Property (
* property="type",
* type="string"
*
* @OA\Items (
* ),
* @OA\Property (
* property="start_year",
* type="integer"
*
* ),
* ),
* },
* ),
* ),
* @OA\Property(
* property="characters",
* type="array",
* description="Favorite Characters",
* @OA\Items (
* type="object",
* allOf={
* @OA\Schema (ref="#/components/schemas/character_meta"),
* @OA\Schema (ref="#/components/schemas/mal_url_2"),
* },
* ),
* ),
* @OA\Property(
* property="people",
* type="array",
* description="Favorite People",
* @OA\Items (
* type="object",
*
* @OA\Property (
* type="object",
*
* allOf={
* @OA\Schema (ref="#/components/schemas/anime_meta"),
* @OA\Schema (
* @OA\Property (
* property="type",
* type="string"
* ),
* @OA\Property (
* property="start_year",
* type="integer"
* ),
* ),
* },
* ),
* ),
* @OA\Property(
* property="manga",
* type="array",
* description="Favorite Manga",
*
* @OA\Items (
* type="object",
* allOf={
* @OA\Schema (ref="#/components/schemas/manga_meta"),
* @OA\Schema (
* @OA\Property (
* property="type",
* type="string"
*
* ),
* @OA\Property (
* property="start_year",
* type="integer"
*
* ),
* ),
* },
* ),
* ),
* @OA\Property(
* property="characters",
* type="array",
* description="Favorite Characters",
* @OA\Items (
* type="object",
* allOf={
* @OA\Schema (ref="#/components/schemas/character_meta"),
* @OA\Schema (
* @OA\Property (
* type="object",
* ref="#/components/schemas/mal_url_2",
* ),
* ),
* },
* ),
* ),
* @OA\Property(
* property="people",
* type="array",
* description="Favorite People",
* @OA\Items (
* type="object",
*
* @OA\Property (
* type="object",
* ref="#/components/schemas/character_meta",
* ),
* ),
* ),
* ),
* ),
* ref="#/components/schemas/character_meta",
* ),
* ),
* ),
* ),
*/
public function toArray($request)
{
return $this->favorites;
}
}
}

View File

@ -3257,7 +3257,12 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/user_favorites"
"properties": {
"data": {
"$ref": "#/components/schemas/user_favorites"
}
},
"type": "object"
}
}
}
@ -7136,89 +7141,78 @@
},
"user_favorites": {
"properties": {
"data": {
"description": "Favorite entries",
"properties": {
"anime": {
"description": "Favorite Anime",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"properties": {
"type": {
"type": "string"
},
"start_year": {
"type": "integer"
}
},
"type": "object"
},
{
"$ref": "#/components/schemas/anime_meta"
}
]
}
},
"manga": {
"description": "Favorite Manga",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"properties": {
"type": {
"type": "string"
},
"start_year": {
"type": "integer"
}
},
"type": "object"
},
{
"$ref": "#/components/schemas/manga_meta"
}
]
}
},
"characters": {
"description": "Favorite Characters",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"properties": {
"": {
"$ref": "#/components/schemas/mal_url_2"
}
},
"type": "object"
},
{
"$ref": "#/components/schemas/character_meta"
}
]
}
},
"people": {
"description": "Favorite People",
"type": "array",
"items": {
"anime": {
"description": "Favorite Anime",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"properties": {
"": {
"$ref": "#/components/schemas/character_meta"
"type": {
"type": "string"
},
"start_year": {
"type": "integer"
}
},
"type": "object"
},
{
"$ref": "#/components/schemas/anime_meta"
}
}
},
"type": "object"
]
}
},
"manga": {
"description": "Favorite Manga",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"properties": {
"type": {
"type": "string"
},
"start_year": {
"type": "integer"
}
},
"type": "object"
},
{
"$ref": "#/components/schemas/manga_meta"
}
]
}
},
"characters": {
"description": "Favorite Characters",
"type": "array",
"items": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/character_meta"
},
{
"$ref": "#/components/schemas/mal_url_2"
}
]
}
},
"people": {
"description": "Favorite People",
"type": "array",
"items": {
"properties": {
"": {
"$ref": "#/components/schemas/character_meta"
}
},
"type": "object"
}
}
},
"type": "object"
@ -8263,4 +8257,4 @@
"description": "About",
"url": "https://jikan.moe"
}
}
}