From 3d68dd5e69699e20fc88a5db29e73d8e5ec62dc8 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 05:41:38 +0000 Subject: [PATCH] fix(ci): Fix linting and add missing OpenAPI schema for test data endpoint - Fixed isort import ordering in test_data_routes.py (stdlib imports before local) - Added /api/admin/generate-test-data endpoint to frontend openapi.json - Added GenerateTestDataRequest, GenerateTestDataResponse, and TestDataScriptType schemas Co-authored-by: Nicholas Tindle --- .../api/features/admin/test_data_routes.py | 12 ++-- .../frontend/src/app/api/openapi.json | 72 +++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/autogpt_platform/backend/backend/api/features/admin/test_data_routes.py b/autogpt_platform/backend/backend/api/features/admin/test_data_routes.py index 075fed95ed..eec2dc9fcc 100644 --- a/autogpt_platform/backend/backend/api/features/admin/test_data_routes.py +++ b/autogpt_platform/backend/backend/api/features/admin/test_data_routes.py @@ -93,19 +93,21 @@ async def generate_test_data( try: if request.script_type == TestDataScriptType.E2E: - from backend.data.db import prisma - # Import and run the E2E test data creator # We need to import within the function to avoid circular imports import sys from pathlib import Path + from backend.data.db import prisma + # Add the test directory to the path test_dir = Path(__file__).parent.parent.parent.parent.parent / "test" sys.path.insert(0, str(test_dir)) try: - from e2e_test_data import TestDataCreator # type: ignore[import-not-found] + from e2e_test_data import ( + TestDataCreator, # type: ignore[import-not-found] + ) # Connect to database if not already connected if not prisma.is_connected(): @@ -140,7 +142,9 @@ async def generate_test_data( sys.path.insert(0, str(test_dir)) try: - from test_data_creator import main as create_full_test_data # type: ignore[import-not-found] + from test_data_creator import ( + main as create_full_test_data, # type: ignore[import-not-found] + ) await create_full_test_data() diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json index 249d67e749..6defa91c53 100644 --- a/autogpt_platform/frontend/src/app/api/openapi.json +++ b/autogpt_platform/frontend/src/app/api/openapi.json @@ -75,6 +75,47 @@ "security": [{ "HTTPBearerJWT": [] }] } }, + "/api/admin/generate-test-data": { + "post": { + "tags": ["v2", "admin"], + "summary": "Generate Test Data", + "operationId": "postAdminGenerateTestData", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateTestDataRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateTestDataResponse" + } + } + } + }, + "401": { + "$ref": "#/components/responses/HTTP401NotAuthenticatedError" + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearerJWT": [] }] + } + }, "/api/api-keys": { "get": { "tags": ["v1", "api-keys"], @@ -7032,6 +7073,32 @@ "required": ["name", "description"], "title": "Graph" }, + "GenerateTestDataRequest": { + "properties": { + "script_type": { + "allOf": [{ "$ref": "#/components/schemas/TestDataScriptType" }], + "default": "e2e" + } + }, + "type": "object", + "title": "GenerateTestDataRequest" + }, + "GenerateTestDataResponse": { + "properties": { + "success": { "type": "boolean", "title": "Success" }, + "message": { "type": "string", "title": "Message" }, + "details": { + "anyOf": [ + { "type": "object", "additionalProperties": true }, + { "type": "null" } + ], + "title": "Details" + } + }, + "type": "object", + "required": ["success", "message"], + "title": "GenerateTestDataResponse" + }, "GraphExecution": { "properties": { "id": { "type": "string", "title": "Id" }, @@ -9939,6 +10006,11 @@ ], "title": "SuggestionsResponse" }, + "TestDataScriptType": { + "type": "string", + "enum": ["full", "e2e"], + "title": "TestDataScriptType" + }, "TimezoneResponse": { "properties": { "timezone": {