Skip to content

Pull Request: Comprehensive API Documentation & Versioning (#119)#173

Merged
LaGodxy merged 1 commit into
MettaChain:mainfrom
JerryIdoko:feature/api-docs-versioning-119
Mar 26, 2026
Merged

Pull Request: Comprehensive API Documentation & Versioning (#119)#173
LaGodxy merged 1 commit into
MettaChain:mainfrom
JerryIdoko:feature/api-docs-versioning-119

Conversation

@JerryIdoko
Copy link
Copy Markdown
Contributor

📝 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

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Mar 26, 2026

@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! 🚀

Learn more about application limits

@LaGodxy LaGodxy merged commit 5bced6f into MettaChain:main Mar 26, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing API Documentation

2 participants