feat: add utoipa path annotations to all API handlers and wire OpenAPI spec
- Add #[utoipa::path] annotations to all 70+ handler functions across auth, config, workflow, and message modules - Add IntoParams/ToSchema derives to Pagination, PaginatedResponse, ApiResponse in erp-core, and MessageQuery/TemplateQuery in erp-message - Collect all module paths into OpenAPI spec via AuthApiDoc, ConfigApiDoc, WorkflowApiDoc, MessageApiDoc structs in erp-server main.rs - Update openapi_spec handler to merge all module specs - The /docs/openapi.json endpoint now returns complete API documentation with all endpoints, request/response schemas, and security requirements
This commit is contained in:
@@ -15,3 +15,4 @@ tracing.workspace = true
|
||||
axum.workspace = true
|
||||
sea-orm.workspace = true
|
||||
async-trait.workspace = true
|
||||
utoipa.workspace = true
|
||||
|
||||
@@ -16,7 +16,7 @@ pub struct BaseFields {
|
||||
}
|
||||
|
||||
/// 分页请求
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, utoipa::IntoParams)]
|
||||
pub struct Pagination {
|
||||
pub page: Option<u64>,
|
||||
pub page_size: Option<u64>,
|
||||
@@ -120,7 +120,7 @@ mod tests {
|
||||
}
|
||||
|
||||
/// 分页响应
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug, Serialize, utoipa::ToSchema)]
|
||||
pub struct PaginatedResponse<T> {
|
||||
pub data: Vec<T>,
|
||||
pub total: u64,
|
||||
@@ -130,7 +130,7 @@ pub struct PaginatedResponse<T> {
|
||||
}
|
||||
|
||||
/// API 统一响应
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Debug, Serialize, utoipa::ToSchema)]
|
||||
pub struct ApiResponse<T: Serialize> {
|
||||
pub success: bool,
|
||||
pub data: Option<T>,
|
||||
|
||||
Reference in New Issue
Block a user