Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
✨ Support Python internal description on Pydantic model's docstring#3032
Conversation
Kludex commentedApr 1, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Do you guys have an opinion on this?@PrettyWood@samuelcolvin |
📝 Docs preview for commit00da79c at:https://606608e5d9c9b620c64fe21f--fastapi.netlify.app |
codecovbot commentedApr 1, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #3032 +/- ##========================================= Coverage 100.00% 100.00% ========================================= Files 538 538 Lines 13870 13872 +2 =========================================+ Hits 13870 13872 +2
Help us with your feedback. Take ten seconds to tell ushow you rate us. Have a feature suggestion?Share it here. |
📝 Docs preview for commit1c93179 at:https://60660aa9f6c5301f7f6c8b97--fastapi.netlify.app |
killswitch-GUI commentedJul 14, 2021
Just bumping. |
killswitch-GUI commentedOct 14, 2021
@Kludex Think this one will make it in? |
Kludex commentedOct 14, 2021
I don't know. 😗 |
📝 Docs preview for commit00becde at:https://6311f9a78e0d811162b5915a--fastapi.netlify.app |
tiangolo commentedSep 2, 2022
Awesome, thanks@Kludex! 🍰 |
killswitch-GUI commentedSep 2, 2022
Kludex commentedSep 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@tiangolo Even if coverage didn't drop, Kludex forgot to add a test case for this, jfyk. |
tiangolo commentedSep 2, 2022
Thanks! We can probably add a test in another PR. |
Uh oh!
There was an error while loading.Please reload this page.
Problem
Currently, on FastAPI endpoint functions we can document for OpenAPI description/Swagger and for internal Python purposes:
On Swagger we'll have:

When documenting models, it doesn't have the same behavior:
On Swagger, we'll have:

Solution
The proposedtwo lines of code on this PR, makes it possible to have the same behavior as the endpoint description:

It follows the same idea as:https://github.com/tiangolo/fastapi/blob/10397ddc30ef9bb26e9247f04fe20ce3045081c4/fastapi/routing.py#L350
Related issues
Questions & Alternatives