upgrade: Laravel 13 + swagger-php v6 attributes
Some checks failed
Deploy Backend / deploy (push) Failing after 6m23s
Some checks failed
Deploy Backend / deploy (push) Failing after 6m23s
This commit is contained in:
parent
3246c1cb09
commit
ea1bb2e265
@ -1,85 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @OA\Info(
|
||||
* title="Parsa Aghayi Portfolio API",
|
||||
* version="1.0.0",
|
||||
* description="REST API for Parsa Aghayi's personal portfolio and blog"
|
||||
* )
|
||||
*
|
||||
* @OA\Server(
|
||||
* url="http://localhost:8000/api",
|
||||
* description="Development server"
|
||||
* )
|
||||
* @OA\Server(
|
||||
* url="https://backend.parsaaghayi.ir/api",
|
||||
* description="Production server"
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Skill",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="description", type="string"),
|
||||
* @OA\Property(property="image", type="string"),
|
||||
* @OA\Property(property="link", type="string", nullable=true),
|
||||
* @OA\Property(property="percentage", type="integer")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="AboutMe",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="description", type="string"),
|
||||
* @OA\Property(property="image", type="string"),
|
||||
* @OA\Property(property="skills", type="array", @OA\Items(ref="#/components/schemas/Skill"))
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Service",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="imageSrc", type="string"),
|
||||
* @OA\Property(property="altText", type="string"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="description", type="string"),
|
||||
* @OA\Property(property="created_at", type="string", format="datetime"),
|
||||
* @OA\Property(property="updated_at", type="string", format="datetime")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Project",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="category", type="string", nullable=true),
|
||||
* @OA\Property(property="images", type="array", @OA\Items(type="object")),
|
||||
* @OA\Property(property="created_at", type="string", format="datetime"),
|
||||
* @OA\Property(property="updated_at", type="string", format="datetime")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Category",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="image", type="string")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Post",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer"),
|
||||
* @OA\Property(property="title", type="string"),
|
||||
* @OA\Property(property="body", type="string"),
|
||||
* @OA\Property(property="excerpt", type="string"),
|
||||
* @OA\Property(property="slug", type="string"),
|
||||
* @OA\Property(property="featured_image", type="string", nullable=true),
|
||||
* @OA\Property(property="author", type="object"),
|
||||
* @OA\Property(property="category", type="object"),
|
||||
* @OA\Property(property="tags", type="array", @OA\Items(type="object")),
|
||||
* @OA\Property(property="published_at", type="string", format="datetime", nullable=true)
|
||||
* )
|
||||
*/
|
||||
namespace App;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
#[OA\Info(
|
||||
title: 'Parsa Aghayi Portfolio API',
|
||||
version: '1.0.0',
|
||||
description: 'REST API for Parsa Aghayi\'s personal portfolio and blog'
|
||||
)]
|
||||
#[OA\Server(
|
||||
url: 'http://localhost:8000/api',
|
||||
description: 'Development server'
|
||||
)]
|
||||
#[OA\Server(
|
||||
url: 'https://backend.parsaaghayi.ir/api',
|
||||
description: 'Production server'
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'Skill',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'description', type: 'string'),
|
||||
new OA\Property(property: 'image', type: 'string'),
|
||||
new OA\Property(property: 'link', type: 'string', nullable: true),
|
||||
new OA\Property(property: 'percentage', type: 'integer'),
|
||||
]
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'AboutMe',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'description', type: 'string'),
|
||||
new OA\Property(property: 'image', type: 'string'),
|
||||
new OA\Property(property: 'skills', type: 'array', items: new OA\Items(ref: '#/components/schemas/Skill')),
|
||||
]
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'Service',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'imageSrc', type: 'string'),
|
||||
new OA\Property(property: 'altText', type: 'string'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'description', type: 'string'),
|
||||
new OA\Property(property: 'created_at', type: 'string', format: 'datetime'),
|
||||
new OA\Property(property: 'updated_at', type: 'string', format: 'datetime'),
|
||||
]
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'Project',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'category', type: 'string', nullable: true),
|
||||
new OA\Property(property: 'images', type: 'array', items: new OA\Items(type: 'object')),
|
||||
new OA\Property(property: 'created_at', type: 'string', format: 'datetime'),
|
||||
new OA\Property(property: 'updated_at', type: 'string', format: 'datetime'),
|
||||
]
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'Category',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'image', type: 'string'),
|
||||
]
|
||||
)]
|
||||
#[OA\Schema(
|
||||
schema: 'Post',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'id', type: 'integer'),
|
||||
new OA\Property(property: 'title', type: 'string'),
|
||||
new OA\Property(property: 'body', type: 'string'),
|
||||
new OA\Property(property: 'excerpt', type: 'string'),
|
||||
new OA\Property(property: 'slug', type: 'string'),
|
||||
new OA\Property(property: 'featured_image', type: 'string', nullable: true),
|
||||
new OA\Property(property: 'author', type: 'object'),
|
||||
new OA\Property(property: 'category', type: 'object'),
|
||||
new OA\Property(property: 'tags', type: 'array', items: new OA\Items(type: 'object')),
|
||||
new OA\Property(property: 'published_at', type: 'string', format: 'datetime', nullable: true),
|
||||
]
|
||||
)]
|
||||
class SwaggerDefinitions
|
||||
{
|
||||
}
|
||||
|
||||
15
app/SwaggerGeneratorFactory.php
Normal file
15
app/SwaggerGeneratorFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use L5Swagger\CustomGeneratorInterface;
|
||||
use OpenApi\Generator as OpenApiGenerator;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
class SwaggerGeneratorFactory implements CustomGeneratorInterface
|
||||
{
|
||||
public function create(): OpenApiGenerator
|
||||
{
|
||||
return new OpenApiGenerator(new NullLogger());
|
||||
}
|
||||
}
|
||||
@ -6,10 +6,10 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"darkaonline/l5-swagger": "^9.0",
|
||||
"laravel/framework": "^11.9",
|
||||
"darkaonline/l5-swagger": "^11.0",
|
||||
"laravel/framework": "^13.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"laravel/tinker": "^3.0",
|
||||
"spatie/laravel-translatable": "^6.14"
|
||||
},
|
||||
"require-dev": {
|
||||
@ -18,7 +18,7 @@
|
||||
"laravel/sail": "^1.26",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"phpunit/phpunit": "^11.0.1"
|
||||
"phpunit/phpunit": "^12.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
3329
composer.lock
generated
3329
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,8 @@
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
'serializable_classes' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|
||||
@ -102,6 +102,14 @@
|
||||
],
|
||||
|
||||
'scanOptions' => [
|
||||
/**
|
||||
* Use a custom generator factory that suppresses swagger-php warnings
|
||||
* (which get converted to ErrorException by Laravel).
|
||||
*
|
||||
* @see \OpenApi\Generator
|
||||
*/
|
||||
'generator_factory' => \App\SwaggerGeneratorFactory::class,
|
||||
|
||||
/**
|
||||
* Configuration for default processors. Allows to pass processors configuration to swagger-php.
|
||||
*
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
'middleware' => [
|
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\PreventRequestForgery::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
181
storage/api-docs/api-docs.json
Normal file
181
storage/api-docs/api-docs.json
Normal file
@ -0,0 +1,181 @@
|
||||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"title": "Parsa Aghayi Portfolio API",
|
||||
"description": "REST API for Parsa Aghayi's personal portfolio and blog",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://localhost:8000/api",
|
||||
"description": "Development server"
|
||||
},
|
||||
{
|
||||
"url": "https://backend.parsaaghayi.ir/api",
|
||||
"description": "Production server"
|
||||
}
|
||||
],
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Skill": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"link": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"percentage": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"AboutMe": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"skills": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Skill"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"Service": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"imageSrc": {
|
||||
"type": "string"
|
||||
},
|
||||
"altText": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"Project": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"Category": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"image": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"Post": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"body": {
|
||||
"type": "string"
|
||||
},
|
||||
"excerpt": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"featured_image": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"author": {
|
||||
"type": "object"
|
||||
},
|
||||
"category": {
|
||||
"type": "object"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"published_at": {
|
||||
"type": "string",
|
||||
"format": "datetime",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user