Add Swagger UI renderer and comprehensive API documentation #571
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements comprehensive Swagger/OpenAPI documentation for the MONARC API, making it easier for developers to integrate with MONARC programmatically. The implementation addresses the need to properly display the swagger file and document all API endpoints with their authorization requirements.
Changes
1. Swagger UI Renderer (
public/swagger-ui.html)Created a user-friendly web interface for viewing the API documentation. The page provides:
2. Expanded OpenAPI Specification (
public/swagger.yaml)Significantly expanded the API documentation from 440 to 2,636 lines:
Coverage Statistics:
Documented Endpoints Include:
All endpoints are based on the router configurations from
zm-client/config/module.config.phpandzm-core/config/module.config.php.3. Security/Authorization Documentation
Implemented comprehensive security documentation:
TokenAuthsecurity scheme using API key in header4. API Documentation Guide (
public/API_DOCUMENTATION.md)Created a comprehensive guide covering:
5. Updated Main README
Added a new "API Documentation" section to the main README with:
How to Use
For Developers/Integrators:
/swagger-ui.htmlin your MONARC installationswagger.yamland import into Postman, Insomnia, or other API clientsFor API Consumers:
Technical Details
Testing
Benefits
✅ Easier Integration - Clear API documentation facilitates third-party integrations
✅ Self-Service - Developers can understand and test the API without constant support
✅ Code Generation - OpenAPI spec enables automatic client library generation
✅ API Testing - Import into Postman/Insomnia for quick testing
✅ Standardization - Follows OpenAPI 3.0 industry standards
✅ Maintainability - Clear structure for documenting future API changes
Closes #XXX
Original prompt
Fixes #570
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.