Skip to content

feat: add OpenAPI examples for analysis endpoints#250

Open
Neelr1912 wants to merge 2 commits into
imDarshanGK:mainfrom
Neelr1912:main
Open

feat: add OpenAPI examples for analysis endpoints#250
Neelr1912 wants to merge 2 commits into
imDarshanGK:mainfrom
Neelr1912:main

Conversation

@Neelr1912
Copy link
Copy Markdown

Closes #205

What changed

  • Added openapi_examples to Body(...) on all four analysis endpoints:
    • POST /explanation/ — 3 examples (Python Fibonacci, JS async fetch, auto-detect Java)
    • POST /debugging/ — 3 examples (Python division-by-zero, JS undefined var, clean code)
    • POST /suggestions/ — 3 examples (Python missing types, JS var usage, high-score baseline)
    • POST /analyze/ — 3 examples (Python bubble sort, JS weak password, Python SQL injection)
  • Added model_config with json_schema_extra to CodeRequest in schemas.py
    for the Schema tab in Swagger UI

How to verify

  1. Run uvicorn app.main:app --reload from the backend/ directory
  2. Open http://127.0.0.1:8000/docs
  3. Expand any of the four endpoints → click the Examples dropdown in the request body
  4. Select a sample → hit Execute

Checklist

  • pytest -v passes
  • No new dependencies added
  • No secrets committed
  • Branch is up-to-date with main

@Neelr1912 Neelr1912 requested a review from imDarshanGK as a code owner May 22, 2026 10:29
@Neelr1912
Copy link
Copy Markdown
Author

@imDarshanGK Hi! I've added OpenAPI examples for all four analysis endpoints as requested in #205. All tests pass locally. Ready for your review

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.

Add OpenAPI examples for analysis endpoints

1 participant