📝 Fix docstring of servers parameter
#14405
Merged
+14
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves / related to #12246
It's currently wrongly stated in the docstring for
serversparameter, that by-default FastAPI will include/url in case this parameter is not specified or empty list:fastapi/fastapi/applications.py
Lines 303 to 304 in 5b0625d
This is not true (related part of code). In fact it will be an url containing the value of
root_path(the mounting point of application), and it will be omitted in the generated openapi schema if the mounting point is/.This PR fixes the docstring ad adds a "technical details" note in "behind-a-proxy".
This way we keep current behavior and just clarify the docs.
Alternatively we may want to change the behavior to add server with url equals to
/instead of omittingserversproperty in case the app's mounting point is/andserversparameter is not specified by developer