-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
onlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Description
π Add API Documentation for Stellar Wallet Service π οΈ
π Description
Create comprehensive API documentation for all endpoints in the Stellar wallet service using Swagger/OpenAPI. The documentation will cover all existing routes (e.g., authentication, KYC, wallet operations) to provide clear guidance for developers and users, ensuring easy integration and understanding of the APIβs functionality.
π― Objective
Generate an OpenAPI specification in services/stellar-wallet/docs/api.yaml and integrate Swagger UI to serve interactive documentation at /docs, with a unit test to verify accessibility.
π Structure
- Directory:
services/stellar-wallet - Files:
docs/api.yamlsrc/routes/docs.jstests/routes/docs.test.jspackage.json(updated)
- Expected structure:
services/stellar-wallet βββ src β βββ index.js β βββ stellar β β βββ client.js β β βββ keys.js β β βββ fund.js β β βββ sign.js β βββ db β β βββ kyc.js β βββ routes β β βββ kyc.js β β βββ kyc-verify.js β β βββ kyc-status.js β β βββ auth-register.js β β βββ auth-verify.js β β βββ auth-login.js β β βββ wallet.js β β βββ docs.js β βββ kyc β β βββ validate.js β βββ soroban β β βββ client.js β β βββ kyc-contract.rs β β βββ deploy.js β βββ auth β β βββ webauthn.js β β βββ jwt.js β βββ middleware β βββ rate-limit.js βββ config β βββ db.sqlite βββ docs β βββ api.yaml βββ tests β βββ stellar β β βββ client.test.js β β βββ keys.test.js β β βββ fund.test.js β β βββ sign.test.js β βββ db β β βββ kyc.test.js β βββ routes β β βββ kyc.test.js β β βββ kyc-verify.test.js β β βββ kyc-status.test.js β β βββ auth-register.test.js β β βββ auth-verify.test.js β β βββ auth-login.test.js β β βββ wallet.test.js β β βββ docs.test.js β βββ kyc β β βββ validate.test.js β βββ soroban β β βββ client.test.js β β βββ deploy.test.js β βββ auth β β βββ jwt.test.js β βββ middleware β βββ rate-limit.test.js βββ package.json βββ .env.example βββ .eslintrc.json βββ .eslintignore βββ .prettierrc.json βββ .prettierignore βββ .gitignore
β Requirements
- Create a branch named
feat/api-documentationfor this task. - Install Swagger dependencies using
npm install swagger-ui-express yamljs. - Update
package.jsonto includeswagger-ui-expressandyamljsas dependencies. - Create
docs/api.yamlto define an OpenAPI 3.0 specification for all API endpoints, including:/auth/register(POST, Issue 17)/auth/verify(POST, Issue 18)/auth/login(POST, Issue 20)/kyc/submit(POST, Issue 9)/kyc/verify(POST, Issue 14)/kyc/status/:id(GET, Issue 15)/wallet/create(POST, Issue 19)/wallet/send(POST, Issue 23)/wallet/transactions/:user_id(GET, Issue 24)
- Include in
api.yaml:- Endpoint paths, methods, request/response schemas, and HTTP status codes.
- Security schemes for JWT authentication (Bearer token) for protected endpoints.
- Descriptions, parameters, and example responses for each endpoint.
- Create
src/routes/docs.jsto serve Swagger UI at/docsusingswagger-ui-express, loading theapi.yamlspecification. - Update
src/index.jsto mount the documentation route at/docswithout JWT or rate-limiting middleware. - Create a unit test in
tests/routes/docs.test.jsto verify that the/docsendpoint returns HTTP 200 and serves the Swagger UI. - Mock the Express app in the unit test to avoid external dependencies.
- Ensure the code adheres to ESLint and Prettier rules (from Issue 3).
- Commit changes to the
feat/api-documentationbranch with a message likefeat: add api documentation. - Verify that the CI pipeline (from Issue 1) passes, with linting and test jobs succeeding.
π Expected Outcomes
swagger-ui-expressandyamljsare installed and listed inpackage.json.docs/api.yamlcontains a complete OpenAPI 3.0 specification for all API endpoints.src/routes/docs.jsserves Swagger UI at/docs, displaying interactive documentation./docsendpoint is accessible without authentication or rate limiting.- Unit test in
tests/routes/docs.test.jsconfirms the/docsendpoint returns HTTP 200. - Code passes ESLint and Prettier checks.
- Changes are committed to the
feat/api-documentationbranch with a descriptive lowercase commit message. - CI pipeline runs successfully, with linting passing for
src/routes/docs.jsandtests/routes/docs.test.js, and the unit test passing.
π References
π Notes
- The OpenAPI specification should include detailed schemas for request bodies (e.g., JSON payloads for
/kyc/submit) and responses. - Use examples in
api.yamlto illustrate typical inputs and outputs. - The
/docsendpoint should be publicly accessible to facilitate developer onboarding. - Mocking the Express app in tests ensures reliable CI execution.
- Commit messages must be in lowercase and start with
feat,change,fix,chore, orrefactor. - The CI pipeline should validate the new code, ensuring ESLint passes and the unit test executes successfully.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
onlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week