update openapi

This commit is contained in:
2026-03-06 16:55:46 +08:00
parent d00af8372c
commit 4b10572794
3 changed files with 74 additions and 1 deletions
+57
View File
@@ -0,0 +1,57 @@
<?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
{
}