Thanks to visit codestin.com
Credit goes to github.com

Skip to content

✨ Add OpenAPI external_docs parameter to FastAPI#13713

Merged
tiangolo merged 20 commits into
fastapi:masterfrom
cmtoro:add-openapi-external-docs-parameter
Sep 20, 2025
Merged

✨ Add OpenAPI external_docs parameter to FastAPI#13713
tiangolo merged 20 commits into
fastapi:masterfrom
cmtoro:add-openapi-external-docs-parameter

Conversation

@cmtoro

@cmtoro cmtoro commented May 13, 2025

Copy link
Copy Markdown
Contributor

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.

cmtoro and others added 3 commits May 13, 2025 12:17
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.
@cmtoro cmtoro changed the title Add openapi external docs parameter bug: Add openapi external docs parameter May 13, 2025
@cmtoro cmtoro changed the title bug: Add openapi external docs parameter [bug]: Add openapi external docs parameter May 13, 2025
@svlandeg svlandeg changed the title [bug]: Add openapi external docs parameter ✨ Add openapi external docs parameter Jun 23, 2025
@svlandeg svlandeg added the feature New feature or request label Jun 23, 2025

@YuriiMotov YuriiMotov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmtoro, thanks for your interest and efforts!

I think that description should be simplified.
Please review my suggestions

Comment thread fastapi/applications.py Outdated
Comment thread fastapi/applications.py Outdated
Comment thread fastapi/applications.py Outdated
Comment thread fastapi/applications.py Outdated
Comment thread tests/test_openapi_examples.py Outdated
cmtoro and others added 4 commits July 17, 2025 18:40
remove https://commonmark.org/ reference from openapi_external_docs documentation
@cmtoro cmtoro requested a review from YuriiMotov July 18, 2025 00:03
@github-actions github-actions Bot removed the waiting label Jul 18, 2025

@YuriiMotov YuriiMotov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Not sure we need this parameter, but if we want to add it, then this PR effectively does it.

@cmtoro, thanks!

@github-actions github-actions Bot removed the waiting label Aug 1, 2025
@tiangolo tiangolo changed the title ✨ Add openapi external docs parameter ✨ Add OpenAPI external_docs parameter to FastAPI Sep 20, 2025

@tiangolo tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you! 🚀

@tiangolo tiangolo merged commit bc5013c into fastapi:master Sep 20, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants