-
Notifications
You must be signed in to change notification settings - Fork 0
Backend API Documentation Guide
This page explains how our API documentation is generated, how to access it, and how to ensure your endpoints are correctly documented.
We use drf-spectacular to generate OpenAPI 3.0 compliant documentation. Unlike older tools, drf-spectacular is the modern standard for Django Rest Framework (DRF), offering better support for type hints and complex serializers.
- Introspection: drf-spectacular inspects our serializers.py, models.py, and views.py.
- Schema Creation: It creates a YAML/JSON schema representing all routes, request bodies, and response types.
- UI Rendering: This schema is then rendered by Swagger UI or ReDoc for a human-readable interface.
Once the server is running locally, you can access the documentation at:
- Swagger UI (Interactive): http://localhost:8000/api/docs/
- SReDoc (Reading-focused): http://localhost:8000/api/schema/redoc/
- Raw Schema: http://localhost:8000/api/schema/
For most standard ModelViewSet or GenericAPIView setups, drf-spectacular will handle everything automatically. However, to keep the documentation high-quality, follow these rules:
-
A. Use Serializers for Everything: Always define serializer_class in your views. The documentation uses these to define the "Data Models" you see at the bottom of the Swagger page.
-
B. Use Docstrings: The first line of your ViewSet or method docstring will become the Summary, and the rest will become the Description in Swagger.
-
C. Customizing with @extend_schema: If an endpoint has special parameters or multiple response types, use the decorator.
To see the documentation on your local machine, ensure you have the library installed. Run: pip install drf-spectacular Ensure it's in our requirements.txt (I will handle this in the first PR).
Links: Home | Main Repository
Team Members
- Software Requirements Specification (SRS)
- Requirement Elicitation Questions
- Scenarios: Mentee New Register
- Scenarios: Mentee Already Registered
- Scenarios: Mentor Already Registered
- Use Case Diagram (Initial) - 1
- Use Case Diagram (Initial) - 2
- Use Case Diagram (Initial) - 3
- Use Case Diagram (Final)
- Class Diagram
- Sequence Diagrams
- Final Milestone Deliverables
- Final Project Review
- Final Progress Based on Teamwork
- Final Individual Contributions
- Final Demo Plan
- MVP Deliverables
- MVP Plan
- MVP Demo Plan
- MVP Demo Backup
- MVP Milestone Review
- MVP Feedback Report
- MVP Individual Contributions
- Project Plan
- Communication Plan
- Test Plan & Coverage
- Acceptance Testing Strategy
- Acceptance Tests Checklist
- Last Week Checklist
- Responsibility Assignment Matrix (RAM)
- Use of Standards
- Project Standards & Workflow
- Project Retrospective
- API Documentation
- Knowledge Base