Skip to content

feat: add OpenAPI 3.1 spec and interactive Swagger UI docs page (#241)#278

Closed
devendra-w wants to merge 13 commits into
Priyanshu-byte-coder:mainfrom
devendra-w:feat/openapi-docs
Closed

feat: add OpenAPI 3.1 spec and interactive Swagger UI docs page (#241)#278
devendra-w wants to merge 13 commits into
Priyanshu-byte-coder:mainfrom
devendra-w:feat/openapi-docs

Conversation

@devendra-w
Copy link
Copy Markdown
Contributor

Summary

Adds an OpenAPI 3.1 spec and interactive Swagger UI docs page for all ~20 DevTrack API routes. New contributors can now explore, understand, and test all endpoints from a single interactive page at /api-docs.
Closes #241

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added public/openapi.yaml — full OpenAPI 3.1 spec documenting all API routes across Auth, Badges, Goals, Metrics, Public, Streak and User groups
  • Added src/app/api-docs/page.tsx — interactive Swagger UI page served at /api-docs
  • Installed swagger-ui-react and @types/swagger-ui-react

How to Test

  1. Clone the repo and run npm install
  2. Run npm run dev
  3. Navigate to http://localhost:3000/api-docs
  4. Verify all route groups are visible: Auth, Badges, Goals, Metrics, Public, Streak, User
  5. Click any endpoint to expand and view params, request body and response schema

Screenshots (if UI change)

image image image image image

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

@devendra-w is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Hi @devendra-w — this PR has a merge conflict (likely package-lock.json). Please rebase your branch:

git fetch upstream
git rebase upstream/main
# for package-lock.json conflicts: delete the file and run npm install to regenerate
git push --force-with-lease

Once rebased, we'll do a full review.

@devendra-w devendra-w force-pushed the feat/openapi-docs branch from f999a40 to b8a4ef4 Compare May 19, 2026 10:39
@devendra-w
Copy link
Copy Markdown
Contributor Author

Rebased on main, resolved package-lock.json conflict by regenerating it via npm install. Ready for review @Priyanshu-byte-coder !

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea — Swagger UI gives contributors a way to explore the API. Two fixes:

1. Hardcoded colors
bg-white, text-gray-900, text-gray-500 on the page — use CSS vars consistent with the rest of the app:

<main className="min-h-screen bg-[var(--background)]">
  <h1 className="... text-[var(--foreground)]">
  <p className="... text-[var(--muted-foreground)]">

Note: swagger-ui-react injects its own CSS (swagger-ui.css) which uses hardcoded colors internally — that's out of scope, just fix the wrapper container.

2. Missing newline at EOF
api-docs/page.tsx ends without a trailing newline. Add one.

@Priyanshu-byte-coder Priyanshu-byte-coder added level:intermediate GSSoC: Intermediate difficulty (35 pts) gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 20, 2026
Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues found in this PR:

  • Missing EOF newline — add a trailing newline to all modified files.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues in the Swagger UI page:

  1. Missing EOF newline — add a trailing newline to the page file.

  2. Raw Tailwind colors break themingbg-white, text-gray-900, text-gray-500 are hardcoded. Replace with CSS vars:

    • bg-whitebg-[var(--background)]
    • text-gray-900text-[var(--foreground)]
    • text-gray-500text-[var(--muted-foreground)]

@github-actions github-actions Bot added type:design GSSoC type bonus: UI/design (+10 pts) type:testing GSSoC type bonus: tests (+10 pts) labels May 22, 2026
@devendra-w
Copy link
Copy Markdown
Contributor Author

Hey @Priyanshu-byte-coder all changes made as requested ready for re-review and merge!
Thankyou!

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 missing EOF newlines — all changed files must end with \n.

@devendra-w
Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder , the TypeScript errors in src/app/api/metrics/contributions/route.ts and src/app/api/metrics/issues/route.ts are pre-existing issues on the main branch confirmed by git diff upstream/main showing zero changes to these files in this PR. These errors exist on main independently of my changes.

@devendra-w
Copy link
Copy Markdown
Contributor Author

Hey @Priyanshu-byte-coder, Regenerated package-lock.json with all swagger-ui-react dependencies included. CI should pass now triggered a rerun. Ready to merge!

@Priyanshu-byte-coder Priyanshu-byte-coder added the gssoc:approved GSSoC: PR approved for scoring label May 24, 2026
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase on the latest main branch and re-request review. The approach is approved — just needs conflict resolution.

@devendra-w
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder i have resolved the merge conflicts.

@devendra-w
Copy link
Copy Markdown
Contributor Author

Resolved in a clean rebase opened new PR #1000 based on latest main. Closing this one.

@devendra-w devendra-w closed this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add OpenAPI 3.1 spec and interactive docs page for all /api routes

2 participants