✨ Add OpenAPI external_docs parameter to FastAPI#13713
Merged
tiangolo merged 20 commits intoSep 20, 2025
Merged
Conversation
external_docs is missing in FastAPI class. Added it to __init__ method to generate openapi spec
The OpenAPI class is being instantiated without the externalDocs parameter.
YuriiMotov
requested changes
Jul 16, 2025
YuriiMotov
left a comment
Member
There was a problem hiding this comment.
@cmtoro, thanks for your interest and efforts!
I think that description should be simplified.
Please review my suggestions
Co-authored-by: Motov Yurii <[email protected]>
Co-authored-by: Motov Yurii <[email protected]>
Co-authored-by: Motov Yurii <[email protected]>
remove https://commonmark.org/ reference from openapi_external_docs documentation
YuriiMotov
approved these changes
Aug 1, 2025
YuriiMotov
left a comment
Member
There was a problem hiding this comment.
LGTM
Not sure we need this parameter, but if we want to add it, then this PR effectively does it.
@cmtoro, thanks!
external_docs parameter to FastAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds an external_docs parameter to the init method of the FastAPI class. Currently, the external_docs parameter is not being passed when generating the OpenAPI documentation, which I believe is an oversight. By including this parameter in the FastAPI class constructor, the external_docs field will be correctly included in the root of the generated OpenAPI JSON or YAML file.
Reasoning:
The external_docs field provides valuable external documentation links and should be part of the OpenAPI metadata. Including it at the root level of the OpenAPI spec enhances the usability and completeness of the generated documentation, especially for providing references to external resources.