]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commit
✨ Add support for `openapi_examples` in all FastAPI parameters (#10152)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 26 Aug 2023 18:03:13 +0000 (20:03 +0200)
committerGitHub <noreply@github.com>
Sat, 26 Aug 2023 18:03:13 +0000 (20:03 +0200)
commit1b714b317732df1e08983e4a8ffe2e4e02c995e0
tree4c710775966f1f8e535a4afb44e7f3003ed874fd
parent5f855b1179d06c8b82f479013e5888c48e68c716
✨ Add support for `openapi_examples` in all FastAPI parameters (#10152)

* ♻️ Refactor model for OpenAPI Examples to use a reusable TypedDict

* ✨ Add support for openapi_examples in parameters

* 📝 Add new docs examples for new parameter openapi_examples

* 📝 Update docs for Schema Extra to include OpenAPI examples

* ✅ Add tests for new source examples, for openapi_examples

* ✅ Add tests for openapi_examples corner cases and all parameters

* 💡 Tweak and ignore type annotation checks for custom TypedDict
16 files changed:
docs/en/docs/tutorial/schema-extra-example.md
docs_src/schema_extra_example/tutorial005.py [new file with mode: 0644]
docs_src/schema_extra_example/tutorial005_an.py [new file with mode: 0644]
docs_src/schema_extra_example/tutorial005_an_py310.py [new file with mode: 0644]
docs_src/schema_extra_example/tutorial005_an_py39.py [new file with mode: 0644]
docs_src/schema_extra_example/tutorial005_py310.py [new file with mode: 0644]
fastapi/openapi/models.py
fastapi/openapi/utils.py
fastapi/param_functions.py
fastapi/params.py
tests/test_openapi_examples.py [new file with mode: 0644]
tests/test_tutorial/test_schema_extra_example/test_tutorial005.py [new file with mode: 0644]
tests/test_tutorial/test_schema_extra_example/test_tutorial005_an.py [new file with mode: 0644]
tests/test_tutorial/test_schema_extra_example/test_tutorial005_an_py310.py [new file with mode: 0644]
tests/test_tutorial/test_schema_extra_example/test_tutorial005_an_py39.py [new file with mode: 0644]
tests/test_tutorial/test_schema_extra_example/test_tutorial005_py310.py [new file with mode: 0644]