UNCLASSIFIED - NO CUI

Skip to content

Swagger UI integration

The BigBang Edge Controller test framework provides REST API endpoints through results_server.py, but lacks comprehensive API documentation and interactive testing capabilities. Developers and operators need clear, interactive documentation to understand and use the API endpoints effectively.

Current State

Existing API Endpoints

The test results server currently provides:

  • /api/tests - Get all test results as JSON
  • /api/tests/<test_id> - Get specific test result by ID
  • /api/tests/status/<status> - Get tests filtered by status (pass/fail/waiting)
  • /api/summary - Get test results summary with counts

Current Limitations

  • Limited API Documentation: Endpoints lack formal documentation
  • No Interactive Testing: Cannot test API calls through web interface
  • Poor Discoverability: Users must read source code to understand API
  • No Schema Validation: Request/response formats not formally defined
  • Missing Examples: No sample requests/responses for guidance

Proposed Solution

Implement Swagger/OpenAPI 3.0 documentation framework integrated with the Flask test results server:

1. Swagger UI Integration

  • Add Flask-RESTX or Flask-Swagger-UI dependency
  • Serve interactive Swagger documentation at /api/docs
  • Enable "Try it out" functionality for all endpoints
  • Provide comprehensive API exploration interface

2. OpenAPI Specification

  • Define formal API schema with OpenAPI 3.0 specification
  • Document all request/response models and formats
  • Include parameter validation and constraints
  • Specify authentication requirements (basic auth)

3. Enhanced Documentation

  • Add detailed endpoint descriptions and use cases
  • Include sample requests and responses
  • Document error codes and handling
  • Provide deployment-specific examples

Implementation Requirements

Core Dependencies

# Add to requirements.txt
flask-restx==1.1.0  # Swagger integration
flask-swagger-ui==4.11.1  # Alternative Swagger UI

API Documentation Structure

openapi: 3.0.0
info:
  title: BigBang Edge Test Results API
  version: 1.0.0
  description: REST API for BigBang Edge Controller test framework
paths:
  /api/tests:
    get:
      summary: Get all test results
      responses:
        200:
          description: List of all test results
  /api/tests/{test_id}:
    get:
      summary: Get specific test result
      parameters:
        - name: test_id
          in: path
          required: true
          schema:
            type: string

Endpoint Enhancements

  • Add request/response validation using marshmallow or pydantic
  • Implement proper HTTP status codes (200, 404, 400, 500)
  • Add pagination support for large test result sets
  • Include filtering and sorting capabilities
Edited by Alfredo Diaz