docs: accurate OpenAPI spec and API.md for all v1 routes#104
Merged
Conversation
- swagger.ts: fix server URL to /api/v1, add all 9 tags, extend apis scan to include app.ts for the health route - schemas.ts: add all previously missing component schemas (ErrorResponse, PublicUser, UpdateUserInput, ChangePasswordInput, UpdateWalletInput, Referral*, Notification*, Sync*, Employer*); fix enum values to match runtime (learner/employer, not LEARNER) - All controllers: add operationId to every operation (28 total); add security:[] override on public routes; fix stale paths in user.controller.ts (/users/profile -> /users/me, PUT -> PATCH); add JSDoc to employer.controller.ts (was fully undocumented); add missing getUserById/changePassword/updateWallet operations; add ErrorResponse refs on all error statuses - docs/API.md: full rewrite reflecting actual runtime behaviour; correct base URL to /api/v1; remove fictional fields (language, USDC asset, timeSpent, anonymousId); mark stub routes as Preview
7 tasks
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.
Closes #65 Closes #71
docs: accurate OpenAPI spec and API.md for all v1 routes
Summary
Makes the OpenAPI spec and checked-in API reference faithful to the running code. Every implemented route now has a corresponding operation with a unique
operationId, correct security declarations, accurate request/response schemas, and no fictional fields or stale paths.Changes
src/config/swagger.tsservers[].urlfrom/api→/api/v1so Swagger Try-it-out sends requests to the right base pathHealth,Auth,Users,Modules,Credentials,Rewards,Referrals,Notifications,Sync,Employer)apisscan to includesrc/app.ts(health route) andsrc/routes/**/*.tssrc/docs/schemas.tsErrorResponse,PublicUser,UpdateUserInput,ChangePasswordInput,UpdateWalletInput,ReferralCodeResponse,ApplyReferralInput,ApplyReferralResponse,ReferralStats,RegisterDeviceInput,NotificationPreferencesInput,NotificationLog,SyncProgressEvent,SyncCompletionEvent,SyncResult,SyncResponse,CandidateSummary,EmployerSearchResponse,CandidateProfile,ContactCandidateInput,ContactCandidateResponselearner/employernotLEARNER/EMPLOYER)CredentialList.metafield names (hasNextPage/hasPrevPageto match actual response)All controllers
operationIdto all 28 operationssecurity: []override on all public routes (auth endpoints,GET /modules,GET /modules/:id,GET /credentials/verify/:onChainId,GET /users/:id) so they don't inherit the global bearer requirementuser.controller.ts:PUT /users/profile→PATCH /users/me, added missingGET /users/:id,PATCH /users/password,PATCH /users/walletoperationsemployer.controller.ts— all three functions were completely undocumented$ref: '#/components/schemas/ErrorResponse'to all error response statusesdescriptionfields with behavioural detail (rate-limit notes, plan gating, idempotency behaviour, score threshold, etc.)docs/API.md/api/v1throughout (old doc used/v1/directly and mismatched the mount path)language,asset: "USDC",timeSpent,anonymousId,matchScore,availableForHirePATCH /users/password,PATCH /users/wallet) clearly marked with warningsTesting
/api-docs) will resolve all$refschema references without broken linksAcceptance criteria checklist
operationIds are unique (28 total)security: []; protected routes carrybearerAuthdocs/API.mdmatches the spec