58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App;
|
|
|
|
use OpenApi\Attributes as OA;
|
|
|
|
#[OA\Info(
|
|
version: '1.0.0',
|
|
title: 'Datahub API',
|
|
description: 'Datahub API documentation'
|
|
)]
|
|
#[OA\Server(url: '/api/v1', description: 'API v1')]
|
|
#[OA\SecurityScheme(
|
|
securityScheme: 'bearerAuth',
|
|
type: 'http',
|
|
scheme: 'bearer',
|
|
bearerFormat: 'JWT'
|
|
)]
|
|
#[OA\SecurityScheme(
|
|
securityScheme: 'apiKeyAuth',
|
|
type: 'apiKey',
|
|
in: 'header',
|
|
name: 'X-API-Key'
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'ApiResponse',
|
|
type: 'object',
|
|
properties: [
|
|
new OA\Property(property: 'code', type: 'integer', example: 0),
|
|
new OA\Property(property: 'message', type: 'string', example: 'success'),
|
|
new OA\Property(property: 'data', type: 'object', nullable: true),
|
|
]
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'PaginatedData',
|
|
type: 'object',
|
|
properties: [
|
|
new OA\Property(property: 'items', type: 'array', items: new OA\Items()),
|
|
new OA\Property(property: 'total', type: 'integer', example: 0),
|
|
new OA\Property(property: 'page', type: 'integer', example: 1),
|
|
new OA\Property(property: 'per_page', type: 'integer', example: 15),
|
|
]
|
|
)]
|
|
#[OA\Schema(
|
|
schema: 'ErrorResponse',
|
|
type: 'object',
|
|
properties: [
|
|
new OA\Property(property: 'code', type: 'integer', example: 400),
|
|
new OA\Property(property: 'message', type: 'string', example: 'Bad request'),
|
|
new OA\Property(property: 'data', type: 'object', nullable: true),
|
|
]
|
|
)]
|
|
class OpenApiSpec
|
|
{
|
|
}
|