ApeRAG icon indicating copy to clipboard operation
ApeRAG copied to clipboard

[Improvement] Generate and Use Python SDK for API Calls in E2E Tests

Open iziang opened this issue 5 months ago • 0 comments

Description: Currently, the E2E test code in test_collection.py and similar files uses an HTTP client to directly call API endpoints via URLs. For better maintainability, usability, and to provide a more realistic integration scenario, it would be beneficial to automatically generate a Python SDK from the OpenAPI specification and use this SDK for all API calls in the E2E tests.

Benefits:

  • Ensures the SDK is always up-to-date with the API.
  • Makes E2E tests more robust and easier to maintain.
  • Provides a reference implementation for users who want to integrate with ApeRAG via the SDK, rather than raw HTTP calls.
  • Reduces boilerplate code and potential errors in manual request construction.

Tasks:

  1. Set up automatic SDK generation from the OpenAPI spec (e.g., using openapi-generator).
  2. Refactor E2E tests to use the generated SDK instead of direct HTTP calls.
  3. Document the SDK usage for both internal tests and external users.

Additional Context:

  • The OpenAPI spec is already maintained in the aperag/api directory.
  • This change will also help external users integrate with ApeRAG more easily and consistently.

iziang avatar Jul 11 '25 09:07 iziang