Pull Request: Comprehensive API Documentation & Versioning (#119)#173
Merged
LaGodxy merged 1 commit intoMar 26, 2026
Merged
Conversation
|
@JerryIdoko Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 Description
This PR addresses the critical lack of documentation for the PropChain backend. I have integrated Swagger (OpenAPI 3.0) to provide an interactive playground for developers and implemented API Versioning to ensure backward compatibility as the protocol evolves.
🎯 Key Changes
Swagger UI Integration: Added the swagger-jsdoc and swagger-ui-express (or equivalent for your framework) to auto-generate documentation from controller annotations.
API Versioning (v1): Refactored the routing structure to use /api/v1/ prefixes. This prevents breaking changes for future mobile or web clients.
Usage Examples: Populated the Swagger components/schemas with realistic property and transaction data examples to guide frontend developers.
Auth Documentation: Clearly defined JWT or API Key requirements within the Swagger UI headers so developers can test protected routes (like property minting).
📖 API Versioning Strategy
We have moved from flat routing to a versioned structure to support the long-term growth of MettaChain:
Old: GET /properties
New: GET /api/v1/properties
✅ Acceptance Criteria Checklist
[x] Swagger UI: Accessible at /api-docs or /swagger on the development server.
[x] Comprehensive Specs: All CRUD operations for Properties, Users, and Chain Events are documented.
[x] Real-world Examples: Request/Response bodies include example JSON payloads.
[x] Versioning: Middleware updated to handle v1 routing globally.
🚀 How to Verify
Start the Server: npm run dev (or your local start command).
View Docs: Navigate to http://localhost:PORT/api-docs.
Test Versioning: Try to access a v1 endpoint (e.g., GET /api/v1/health) and verify it returns a 200 OK.
Try it Out: Use the "Try it out" button in Swagger to execute a request against the local database.
🔗 Linked Issues
Closes #119