A beautiful Frappe app to generate and visualize whitelisted APIs with interactive Swagger UI documentation.
- Automatically generates OpenAPI (Swagger) JSON files for all installed Frappe apps.
- Responsive Swagger UI portal with sidebar app selection.
- Displays API endpoints, parameters, sample requests, and responses.
- Install the app in your Frappe site.
- Run
bench migrateto apply changes and update your site. - Run the OpenAPI generator.
- Access the API Explorer UI at
/docsor/redoc. - Select an app from the sidebar to view its API documentation.
- Try out endpoints directly from the Swagger UI.
To ensure your APIs are documented correctly:
- Whitelist your function using
@frappe.whitelist()or inhooks.py. - Add a detailed Python docstring to your function, including:
- Description of what the endpoint does.
- Sample Response format (JSON).
Example:
@frappe.whitelist()
def create_customer(name, email):
"""
Create a new customer.
Response:
{
"status": "success",
"customer_id": "CUS12345"
}
"""
# Your code hereGuidelines:
- Always describe the endpoint's purpose.
- Include clear sample response blocks.
- Keep examples concise and relevant.
- These doc comments are parsed and shown in the API Explorer UI.
agpl-3.0