Skip to content

fix: expose request body schema in Swagger for unannotated endpoints #667#670

Open
korbonits wants to merge 2 commits intoLightning-AI:mainfrom
korbonits:bugfix/667_swagger-request-body
Open

fix: expose request body schema in Swagger for unannotated endpoints #667#670
korbonits wants to merge 2 commits intoLightning-AI:mainfrom
korbonits:bugfix/667_swagger-request-body

Conversation

@korbonits
Copy link
Copy Markdown

What does this PR do?

Fixes #667

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, so clicking "Execute" sent an empty
body and crashed the server with a JSONDecodeError. Now Swagger correctly renders a JSON request body form for endpoints without a Pydantic type annotation on decode_request.

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 🙃 <- Yes I had fun!

@korbonits
Copy link
Copy Markdown
Author

shoot, should i cancel this PR and re-submit since the tests.yml failed? would be good to see failure logs...

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