Commit Graph

103 Commits

Author SHA1 Message Date
Michael Adkins 199916ac8c
📝 Add documentation for redefined path operations (#4864)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-12 11:16:16 -05:00
hitrust 99a41e7f8d
✏ Fix example code with sets in tutorial for body nested models (#3030)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-11 17:29:02 +00:00
Sebastián Ramírez 8a0d4c79c1
Add support for custom `generate_unique_id_function` and docs for generating clients (#4650) 2022-03-04 23:02:18 +01:00
Sebastián Ramírez 1bf55200a9
Add support for declaring `UploadFile` parameters without explicit `File()` (#4469) 2022-01-23 19:14:13 +00:00
Sebastián Ramírez 569afb4378
Add support for tags with Enums (#4468) 2022-01-23 18:43:04 +01:00
Mark ca5d57ea79
Allow hiding from OpenAPI (and Swagger UI) `Query`, `Cookie`, `Header`, and `Path` parameters (#3144)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-01-23 16:54:59 +01:00
John Riebold a85aa125d2
Enable configuring Swagger UI parameters (#2568)
Co-authored-by: Artem Ivanov <artem@worklife.io>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-01-16 20:26:24 +01:00
Sebastián Ramírez 7fe79441c1
📝 Update Python Types docs, add missing 3.6 / 3.9 example (#4434) 2022-01-16 15:44:08 +01:00
Sebastián Ramírez d08a062ee2
Add docs and tests for Python 3.9 and Python 3.10 (#3712)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-01-07 15:11:31 +01:00
Thomas Grainger 11d0a08acd
Add support for Trio via AnyIO (#3372)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-10-06 17:32:11 +02:00
Sebastián Ramírez 4b968c4e39
📝 Update GraphQL docs, recommend Strawberry (#3981) 2021-10-03 20:00:28 +02:00
Edouard Lavery-Plante 836bb97a2d
Add support for extensions and updates to the OpenAPI schema in path operations (#1922)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-29 22:01:13 +02:00
dkreeft 6f45f43709
Add additonal OpenAPI metadata parameters to `FastAPI` class, shown on the automatic API docs UI (#1812)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: dkreeft <dkreeft@xccelerated.io>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-29 17:10:22 +02:00
Marcelo Trylesinski fa2c750443
Add the `docs_src` directory to test coverage and update tests (#1904)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-29 11:26:07 +02:00
Sebastián Ramírez 684c0077cc
Add support for `dataclasses` in request bodies and `response_model` (#3577) 2021-07-21 19:54:08 +02:00
Thomas Grainger 2d296c5d07
🔧 Configure strict pytest options and update/refactor tests (#2790)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-19 21:14:58 +02:00
Sebastián Ramírez dc5a966548
Allow setting the `response_class` to `RedirectResponse` and returning the URL from the function (#3457) 2021-07-03 21:51:28 +02:00
Austin Orr e10a4375f9
Add support for adding multiple examples in request bodies and path, query, cookie, and header params (#1267)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-05 20:20:56 +02:00
Sebastián Ramírez fdb6c9ccc5
Improve type annotations, add support for mypy --strict, internally and for external packages (#2547) 2020-12-20 19:50:00 +01:00
Sebastián Ramírez 313bbe802f
Add support for shared/top-level parameters (dependencies, tags, etc) (#2434)
*  Add Default and DefaultPlaceholder data structures

to handle defaults and overrides

*  Add utils to get values by priority handling DefaultPlaceholders

*  Add support for top-level parameters in FastAPI, APIRouter, include_router

including: prefix, tags, dependencies, deprecated, include_in_schema, responses, default_response_class, callbacks

* ♻️ Update openapi utils to handle DefaultPlaceholder for response_class

* 📝 Update bigger-application example code to use top-level params

and showcase them in APIRouter, FastAPI, include_router

* 📝 Update docs for Bigger Applications, include diagrams, top-level params

* 🔥 Simplify code and docs for callbacks as default_response_class is no longer required

* 📝 Add docs for top-level dependencies, in FastAPI()

* 📝 Add docs reference to top-level dependencies in docs for decorator

*  Update/increase tests for Bigger Applications including shared parameters

*  Add tests for top-level dependencies in FastAPI()

*  Add tests for internal DefaultPlaceholder

*  Update/increase tests for callbacks with top-level parameters

*  Add LOTS of tests covering branches and cases for shared parameters

in top-level FastAPI, path operations, include_router, APIRouter, its path operations, nested include_router, nested APIRouter, and its path operations

* 🎨 Format/reorder parameters for consistency in FastAPI, APIRouter, include_router
2020-11-29 18:32:18 +01:00
nukopy 22a5960d36
📝 Fix code consistency in examples for Tutorial - User Guide - Path Parameters (#2158) 2020-11-05 23:30:09 +01:00
Sebastián Ramírez 24d2226326
Fix tags's declare (#2054) 2020-11-05 22:43:28 +01:00
hitrust c041c52d91
📝 Fix example code with sets in Tutorial - Body - Nested Models 2 (#2053) 2020-11-05 22:41:45 +01:00
hitrust dfcc6bc154
📝 Fix example code with sets in Tutorial - Body - Nested Models (#2052) 2020-11-05 22:38:59 +01:00
hitrust 8486b41349
Fix tags's declare 2020-09-15 14:40:49 +08:00
Rupsi Kaushik 5ed48ccdc8
Export WebSocketDisconnect and add example handling disconnections to docs (#1822)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-09 15:52:19 +02:00
manlix 0752c7242d
🔊 Fix empty log message in docs example about raised exceptions (#1815) 2020-08-09 13:10:33 +02:00
Felix Böhm 2fd28434dd
📝 Add documentation about async tests (pytest-asyncio and httpx) (#1619)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-08 20:01:18 +02:00
Francesco Frassinelli 769ee73240
📝 Add HTML media type to template docs (#1690)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-08-03 09:53:56 +02:00
Brian Mboya 921642dc7b
📝 Update JWT docs to use python-jose (#1610)
* 📝 Update JWT docs with python-jose

* 📝 Update format and use python-jose in docs

*  Add Python-jose to dependencies

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-10 20:24:38 +02:00
Rupsi Kaushik 70a51b3aff
Auto-generate OpenAPI servers from root_path (#1596)
* root_path included in servers object instead of path prefix

* ♻️ Refactor implementation of auto-including root_path in OpenAPI servers

* 📝 Update docs and examples for Behind a Proxy, including servers

* 📝 Update Extending OpenAPI as openapi_prefix is no longer needed

*  Add extra tests for root_path in servers and root_path_in_servers=False

* 🍱 Update security docs images with relative token URL

* 📝 Update security docs with relative token URL

* 📝 Update example sources with relative token URLs

*  Update tests with relative tokens

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-10 19:28:18 +02:00
Brian Mboya fe453f80ed
⬆ Upgrade isort to version 5.x.x (#1670)
* Update isort script to match changes in the new release, isort v5.0.2

* Downgrade isort to version v4.3.21

* Add an alternative flag to --recursive in isort v5.0.2

* Add isort config file

* 🚚 Import from docs_src for tests

* 🎨 Format dependencies.utils

* 🎨 Remove isort combine_as_imports, keep black profile

* 🔧 Update isort config, use pyproject.toml, Black profile

* 🔧 Update format scripts to use explicit directories to format

otherwise it would try to format venv env directories, I have several with different Python versions

* 🎨 Format NoSQL tutorial after re-sorting imports

* 🎨 Fix format for __init__.py

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-07-09 20:06:12 +02:00
Sebastián Ramírez 1f01ce9615
📝 Use Optional in docs (#1644)
* Updated .py files with Optional tag (up to body_nested_models)

* Update optionals

* docs_src/ all updates, few I was unsure of

* Updated markdown files with Optional param

* es: Add Optional typing to index.md

* Last of markdown files updated with Optional param

* Update highlight lines

* it: Add Optional typings

* README.md: Update with Optional typings

* Update more highlight increments

* Update highlights

* schema-extra-example.md: Update highlights

* updating highlighting on website to reflect .py changes

* Update highlighting for query-params & response-directly

* Address PR comments

* Get rid of unnecessary comment

*  Revert Optional in Chinese docs as it probably also requires changes in text

* 🎨 Apply format

*  Revert modified example

* ♻️ Simplify example in docs

* 📝 Update OpenAPI callback example to use Optional

*  Add Optional types to tests

* 📝 Update docs about query params, default to using Optional

* 🎨 Update code examples line highlighting

* 📝 Update nested models docs to use "type parameters" instead of "subtypes"

* 📝 Add notes about FastAPI usage of None

including:

= None

and

= Query(None)

and clarify relationship with Optional[str]

* 📝 Add note about response_model_by_alias

* ♻️ Simplify query param list example

* 🔥 Remove test for removed example

*  Update test for updated example

Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>
Co-authored-by: yk396 <yk396@cornell.edu>
Co-authored-by: Kai Chen <kaichen120@gmail.com>
2020-06-28 20:13:30 +02:00
Chih Sean Hsu e4300769ac
📝 Update tutorial for WebSockets with dependencies (#1540)
* fix websockets/tutorial002.py

* fix tutorial002 in ws to correspond with test case

* reformat websocket tutorial002

* fix websocket tutorial002 coverage

* 📝 Update example for WebSockets with Depends

*  Update and refactor tests for WebSockets with dependencies

* 👷 Trigger Travis, as it's not reporting to Codecov

*  Update WebSocket tests to raise coverage

Co-authored-by: Chih Sean Hsu <Sean@Sean-Mac.local>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 22:51:34 +02:00
Yankee 748bedd37c
📝 Updated docs for path-params (#1521)
* Added response example; URL for quick access; typo fixes

* Added line breaks for readability

* Fix typo on redoc url

* 📝 Update format, links, rewordings

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 19:14:23 +02:00
Roman Tezikov 66cb266641
📝 Add docs for `default_response_class` (#1455)
*  Add docs to default_response_class

*  create a tip

*  fixing the tip

* 🚑 grammar

* 📝 Update docs for default response class

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 18:02:45 +02:00
Chen Rotem Levy fe15620df3
🎨 Update and clarify testing function name (#1395)
test_create_existing_token -> test_create_existing_item
2020-06-13 14:50:14 +02:00
Thomas Maschler a071ddf3cd
Add support for tag metadata in OpenAPI (#1348)
* Allow to add OpenAPI tag descriptions

* fix type hint

* fix type hint 2

* refactor test to assure 100% coverage

* 📝 Update tags metadata example

* 📝 Update docs for tags metadata

*  Move tags metadata test to tutorial subdir

* 🎨 Update format in applications

* 🍱 Update docs UI image based on new example

* 🎨 Apply formatting after solving conflicts

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-13 13:58:06 +02:00
yaegassy 745ab48d65
📝 Add docs in Python Types for Optional (#1377)
* docs: Fix pydantic example in python-types.md

* 📝 Update Python Types Intro to include Optional

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 23:44:23 +02:00
Pankaj Giri 7e2518350a
📝 Remove *, from functions where it's not needed #1234 (#1239)
* Fix for - [FEATURE] Remove *, where it's not needed #1234

* 🔥 Remove unnecessary arg *,

* 🎨 Update docs format highlight lines

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-12 21:41:44 +02:00
Ingmar Steen 2f478eeca6
Add support for ASGI root_path for openapi docs (#1199)
* Use ASGI root_path when it is provided and openapi_prefix is empty.

* Strip trailing slashes from root_path.

* Please mypy.

* Fix extending openapi test.

* 📝 Add docs and tutorial for using root_path behind a proxy

* ♻️ Refactor application root_path logic, use root_path, deprecate openapi_prefix

*  Add tests for Behind a Proxy with root_path

* ♻️ Refactor test

* 📝 Update/add docs for Sub-applications and Behind a Proxy

* 📝 Update Extending OpenAPI with openapi_prefix parameter

*  Add test for deprecated openapi_prefix

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-06-11 23:53:19 +02:00
Beau Barker d53a253c8d
📝 Update location of get_db in SQL docs (#1293) 2020-05-17 12:14:14 +02:00
Sebastián Ramírez 409264960e
Allow disabling docs UIs by disabling OpenAPI (#1421)
*  Allow disabling docs UIs by disabling openapi_url

* 📝 Add docs for disabling OpenAPI and docs in prod or other environments

*  Add tests for disabling OpenAPI and docs
2020-05-16 17:45:12 +02:00
Camila Gutierrez bd1e85a8d3
📝 Add Spanish translation for the Python Types Intro page (#1237)
* Spanish translation Python Types Intro page

* 📝 Fix tuple docs in Types intro

* ✏️ Fix typos and wording nitpicks

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-11 19:20:32 +02:00
Samuel Colvin e9b189e9f2
Improve test debugging (#1222) 2020-04-08 06:37:38 +02:00
duganchen d96223460b
📝 Add an example of setting up a test database (#1144)
* Add an example of setting up a test database.

* 📝 Add/update docs for testing a DB with dependency overrides

* 🔧 Update test script, remove line removing test file as it is removed during testing

*  Update testing coverage pragma

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-05 13:53:09 +02:00
Sebastián Ramírez b76334f544
📝 Settings using lru_cache (#1214)
*  Update settings examples to use lru_cache

* 📝 Update docs for Settings, using @lru_cache

* 🎨 Update lru_cache colors to show difference in stored values
2020-04-04 21:39:15 +02:00
alexmitelman d4d5b21b2e
📝 Add documentation about settings and env vars (#1118)
* Add doc and example for env var config

* Syntax highlight for .env file

* Add test for configuration docs

* 📝 Update settings docs, add more examples

*  Add tests for settings

* 🚚 Rename "Application Configuration" to "Metadata and Docs URLs"

to disambiguate between that and settings

* 🔥 Remove replaced example file

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-04-02 06:55:20 +02:00
Sebastián Ramírez 544afaff97
📝 Add docs for adding example to schema (#1185) 2020-03-30 11:58:48 +02:00
John Paton 016a4b7491
📝 Add documentation of example kwarg of Field (#1106)
* Add documentation of example kwarg of Field

* 📝 Update info about schema examples

* 🚚 Move example file to new directory

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-03-29 21:43:31 +02:00
Sebastián Ramírez 459f0e11e5
🏁 Update Windows development environment and tests (#1179)
* 🏁 Fix ./scripts/docs.py encoding for Windows

* 🔥 Remove ujson from tests as it prevents Windows development

It's still tested by Starlette anyway

* 📝 Update development instructions for Windows

* 🎨 Update format for WSGIMiddleware example

*  Update tests to run on Windows
2020-03-29 17:04:04 +02:00
Tomoya Yoshioka 15241b53a8
📝 Clarify function name in example (#1121) 2020-03-27 17:15:26 +01:00
Sebastián Ramírez 6205935323
Add support for docs translations (#1168)
* 🌐 Refactor file structure to support internationalization

*  Update tests changed after i18n

* 🔀 Merge Typer style from master

* 🔧 Update MkConfig with Typer-styles

* 🎨 Format mkdocs.yml with cannonical form

* 🎨 Format mkdocs.yml

* 🔧 Update MkDocs config

*  Add docs translation scripts dependencies

*  Add Typer scripts to handle translations

*  Add missing translation snippet to include

*  Update contributing docs, add docs for translations

* 🙈 Add docs_build to gitignore

* 🔧 Update scripts with new locations and docs scripts

* 👷 Update docs deploy action with translations

* 📝 Add note about languages not supported in the theme

*  Add first translation, for Spanish
2020-03-26 20:09:53 +01:00