Skip to content

fix: improve request type handling for unannotated endpoints in Swagger#676

Open
jwliu36 wants to merge 1 commit intoLightning-AI:mainfrom
jwliu36:fix/667-swagger-request-body
Open

fix: improve request type handling for unannotated endpoints in Swagger#676
jwliu36 wants to merge 1 commit intoLightning-AI:mainfrom
jwliu36:fix/667-swagger-request-body

Conversation

@jwliu36
Copy link
Copy Markdown

@jwliu36 jwliu36 commented Apr 9, 2026

Fixes #667

What does this PR do?

As a user, I want to use the Swagger UI (/docs) to test my LitServe endpoints interactively. Before this fix, the /predict endpoint showed no input form in Swagger when decode_request had no type annotation, so clicking "Execute" sent an empty body and crashed the server with a JSONDecodeError. Now Swagger correctly renders a JSON request body form for these endpoints.

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85%. Comparing base (8fb245c) to head (912bfb4).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #676   +/-   ##
===================================
  Coverage    85%    85%           
===================================
  Files        39     39           
  Lines      3278   3283    +5     
===================================
+ Hits       2774   2779    +5     
  Misses      504    504           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Swagger UI does not expose request parameters for /predict, causing 500 error when invoked

1 participant