update tests and doc

This commit is contained in:
2026-03-17 12:47:02 +08:00
parent ebcbfaac40
commit ccea43d8d6
4 changed files with 1291 additions and 0 deletions
+34
View File
@@ -166,6 +166,40 @@ use OpenApi\Attributes as OA;
new OA\Property(property: 'failed', type: 'integer', example: 8),
]
)]
#[OA\Schema(
schema: 'ApiRequestLogList',
type: 'object',
description: 'API 请求日志列表项',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'user_id', type: 'integer', example: 1, nullable: true),
new OA\Property(property: 'method', type: 'string', example: 'GET'),
new OA\Property(property: 'path', type: 'string', example: '/api/v1/users'),
new OA\Property(property: 'status_code', type: 'integer', example: 200),
new OA\Property(property: 'ip', type: 'string', example: '127.0.0.1', nullable: true),
new OA\Property(property: 'response_code', type: 'integer', example: 0, nullable: true),
new OA\Property(property: 'duration_ms', type: 'integer', example: 42),
new OA\Property(property: 'created_at', type: 'string', format: 'date-time'),
]
)]
#[OA\Schema(
schema: 'ApiRequestLogDetail',
type: 'object',
description: 'API 请求日志详情(含完整请求体和 User-Agent',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'user_id', type: 'integer', example: 1, nullable: true),
new OA\Property(property: 'method', type: 'string', example: 'POST'),
new OA\Property(property: 'path', type: 'string', example: '/api/v1/users'),
new OA\Property(property: 'status_code', type: 'integer', example: 200),
new OA\Property(property: 'ip', type: 'string', example: '127.0.0.1', nullable: true),
new OA\Property(property: 'user_agent', type: 'string', example: 'Mozilla/5.0', nullable: true),
new OA\Property(property: 'request_body', type: 'object', description: '请求体(脱敏后)', nullable: true),
new OA\Property(property: 'response_code', type: 'integer', example: 0, nullable: true),
new OA\Property(property: 'duration_ms', type: 'integer', example: 42),
new OA\Property(property: 'created_at', type: 'string', format: 'date-time'),
]
)]
class OpenApiSpec
{
}