AutoSchema

This tool is designed to automatically extract API endpoints from a Django project and generate comprehensive documentation using OpenAPI 3.0, enhanced with AI-powered insights.

Description

dj-autoschema

dj-autoschema is an AI-powered API documentation generator for Django projects. It extracts all API endpoints, infers request and response schemas using Pydantic, and generates highly detailed documentation, including:

  • Endpoint descriptions (purpose, necessity)

  • Available features, parameters, and authentication methods

  • Request body, response body, and potential errors

  • Automatic serving of openapi.json to ReDoc

This tool streamlines API documentation by leveraging AI to produce comprehensive and structured OpenAPI specifications.

Installation

pip install dj-autoschema

Usage

  1. Add dj-autoschema to the Django project’s installed apps:

    INSTALLED_APPS = [
        ...
        "dj_autoschema",
    ]
  2. Ensure the .env file exists in the project root and includes the following:

    OPENAI_API_KEY=your_openai_api_key_here
  3. Run the documentation generation command:

    python manage.py generate_api_docs
  4. Start the Django development server:

    python manage.py runserver
  5. View the API documentation at:

    • OpenAPI JSON: http://localhost:8000/openapi.json

    • ReDoc UI: http://localhost:8000/docs/

Features

  • AI-Generated Descriptions: Extracts endpoint details and enhances them with AI-generated explanations.

  • Schema Inference: Uses Pydantic to infer request/response structures.

  • Automated Documentation: No need for manual annotation—just install and run.

  • OpenAPI & ReDoc Support: Serves openapi.json and integrates seamlessly with ReDoc.

License

MIT License

Issues & PRs Board
No issues or pull requests added.