49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use OpenApi\Attributes as OA;
|
|
|
|
#[OA\Info(
|
|
version: '1.1.0',
|
|
title: 'Premium Template API',
|
|
description: 'Unified API for Mobile and Web Integration. Authenticated endpoints require a Bearer token from POST /v1/login.'
|
|
)]
|
|
#[OA\Contact(email: 'admin@example.com')]
|
|
#[OA\Server(url: 'http://localhost:8000/api', description: 'Local')]
|
|
#[OA\Server(url: 'https://yourdomain.com/api', description: 'Production')]
|
|
#[OA\SecurityScheme(
|
|
securityScheme: 'sanctum',
|
|
type: 'http',
|
|
scheme: 'bearer',
|
|
bearerFormat: 'Token',
|
|
description: 'Enter the token returned by POST /v1/login'
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'User',
|
|
properties: [
|
|
new OA\Property(property: 'id', type: 'integer'),
|
|
new OA\Property(property: 'name', type: 'string'),
|
|
new OA\Property(property: 'email', type: 'string', format: 'email'),
|
|
new OA\Property(property: 'is_active', type: 'boolean'),
|
|
new OA\Property(property: 'created_at', type: 'string', format: 'date-time'),
|
|
]
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'ApiSuccess',
|
|
properties: [
|
|
new OA\Property(property: 'status', type: 'string', example: 'success'),
|
|
new OA\Property(property: 'message', type: 'string'),
|
|
new OA\Property(property: 'data', type: 'object', nullable: true),
|
|
]
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'ApiError',
|
|
properties: [
|
|
new OA\Property(property: 'status', type: 'string', example: 'error'),
|
|
new OA\Property(property: 'message', type: 'string'),
|
|
new OA\Property(property: 'errors', type: 'object', nullable: true),
|
|
]
|
|
)]
|
|
class Swagger {}
|