Commit Graph

218 Commits

Author SHA1 Message Date
prostomarkeloff 3f5f81bbdc 📝 Change 'Schema' to 'Field' in docs (#746) 2019-12-09 14:48:54 +01:00
dmontagu ab2b86fe2c Add support for Pydantic v1 and above 🎉 (#646)
* Make compatible with pydantic v1

* Remove unused import

* Remove unused ignores

* Update pydantic version

* Fix minor formatting issue

*  Revert removing iterate_in_threadpool

*  Add backwards compatibility with Pydantic 0.32.2

with deprecation warnings

*  Update tests to not break when using Pydantic < 1.0.0

* 📝 Update docs for Pydantic version 1.0.0

* 📌 Update Pydantic range version to support from 0.32.2

* 🎨 Format test imports

*  Add support for Pydantic < 1.2 for populate_validators

*  Add backwards compatibility for Pydantic < 1.2.0 with required fields

* 📌 Relax requirement for Pydantic to < 2.0.0 🎉 🚀

* 💚 Update pragma coverage for older Pydantic versions
2019-11-27 20:32:02 +01:00
Steven Kalt bac2f587b7 📝 Document overriding operationId for all path operations using their function names (#642) 2019-11-24 15:00:51 +01:00
svalouch 723ef07ccf 📝 Add documentation for self-serving static Swagger UI (#112) (#557) 2019-11-23 22:50:58 +01:00
Sebastián Ramírez 3f9f4a0f8f
Add dependencies with yield (used as context managers) (#595)
*  Add development/testing dependencies for Python 3.6

*  Add concurrency submodule with contextmanager_in_threadpool

*  Add AsyncExitStack to ASGI scope in FastAPI app call

*  Use async stack for contextmanager-able dependencies

including running in threadpool sync dependencies

*  Add tests for contextmanager dependencies

including internal raise checks when exceptions should be handled and when not

*  Add test for fake asynccontextmanager raiser

* 🐛 Fix mypy errors and coverage

* 🔇 Remove development logs and prints

*  Add tests for sub-contextmanagers, background tasks, and sync functions

* 🐛 Fix mypy errors for Python 3.7

* 💬 Fix error texts for clarity

* 📝 Add docs for dependencies with yield

*  Update SQL with SQLAlchemy tutorial to use dependencies with yield

and add an alternative with a middleware (from the old tutorial)

*  Update SQL tests to remove DB file during the same tests

*  Add tests for example with middleware

as a copy from the tests with dependencies with yield, removing the DB in the tests

* ✏️ Fix typos with suggestions from code review

Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
2019-10-09 13:01:58 -05:00
dmontagu 8c3ef76139 Add better support for request body access/manipulation with custom classes (#589) 2019-10-04 19:23:34 -05:00
svalouch c7dc26b760 Allow docstrings to be truncated before being used for OpenAPI (#556) 2019-10-04 15:02:40 -05:00
dmontagu fc7d123347 ⬆️ Upgrade support to Pydantic version 0.32.2 (breaking change) (#463) 2019-08-30 19:30:03 -05:00
Sebastián Ramírez 9a71672a95
📝 Update enum examples to use str, and improve Swagger UI in examples (#351) 2019-06-28 21:27:27 +02:00
Sebastián Ramírez 687065509b
🏗️ Fix same function names in different modules with composite bodies (#347)
* 🏗️ Implement unique IDs for dynamic models

like those used for composite bodies and responses. IDs based on path (not only on function name, as it can be duplicated in a different module).

*  Add tests for same function name and composite body

*  Update OpenAPI in tests with new dynamic model ID generation
2019-06-28 19:35:16 +02:00
Sebastián Ramírez aa84ac8e3e
Implement support for Pydantic's ORM mode (#322)
*  Implement support for Pydantic's ORM mode

* 🏗️ Re-structure/augment SQL tutorial source using ORM mode

* 📝 Update SQL docs with SQLAlchemy, ORM mode, relationships

* 🔥 Remove unused util in tutorial

* 📝 Add tutorials for simple dict bodies and responses

* 🔥 Remove old SQL tutorial

*  Add/update tests for SQL tutorial

*  Add tests for simple dicts (body and response)

* 🐛 Fix cloning field from original field
2019-06-20 11:31:32 +02:00
Eric Du 5b3adfe449 Use default response status reasons in additional responses (#313)
* default the description of additional response to status reason phrase

* fix 404 description

* fix lint warning

* allow custom response status code
2019-06-18 09:46:57 +02:00
James Kaplan f0df79aa91 ⬆️ Upgrade Pydantic to 0.28 (#320) 2019-06-18 09:37:40 +02:00
Sebastián Ramírez 6939621730
bug: Fix handling an empty-body request with a required body param (#311)
* 🐛 Fix solving a required body param from an empty body request

*  Add tests for receiving required body parameters with body not provided
2019-06-13 18:37:48 +02:00
Sebastián Ramírez 5f7fe926ab
Add support for Response parameters to set headers, cookies, and status codes (#294)
*  Add support for declaring a Response parameter to set headers and cookies

*  Add source for docs and tests

* 📝 Add docs for setting headers, cookies and status code

* 📝 Add attribution to Hug for inspiring response parameters
2019-06-06 14:29:40 +04:00
Sebastián Ramírez 09cd7c47a1
Implement dependency overrides for testing (#291)
*  Implement dependency overrides for testing

*  Add docs source tests and extra tests for dependency overrides

* 📝 Add docs for testing dependencies with overrides
2019-06-05 15:43:18 +04:00
Sebastián Ramírez c7db2ff858
🐛 Fix path and query parameters receiving dict as valid (#287)
* 🐛 Fix path and query parameters accepting dict

*  Add several tests to ensure invalid types are not accepted

* 📝 Document (to include tested source) using query params with list

* 🐛 Fix OpenAPI schema in query with list tutorial
2019-06-03 21:59:40 +04:00
Sebastián Ramírez bd407cc4ed
Refactor param extraction using Pydantic Field (#278)
*  Refactor parameter dependency using Pydantic Field

* ⬆️ Upgrade required Pydantic version with latest Shape values

*  Add tutorials and code for using Enum and Optional

*  Add tests for tutorials with new types and extra cases

* ♻️ Format, clean, and add annotations to dependencies.utils

* 📝 Update tutorial for query parameters with list defaults

*  Add tests for query param with list default
2019-05-30 17:40:43 +04:00
Sebastián Ramírez 62af6e0eeb
Separate Pydantic's ValidationError handler and improve docs for error handling (#273)
*  Implement separated ValidationError handlers and custom exceptions

*  Add tutorial source examples and tests

* 📝 Add docs for custom exception handlers

* 📝 Update docs section titles
2019-05-29 16:27:55 +04:00
Sebastián Ramírez 703ade7967
🐛 Fix path in path parameters (#272) 2019-05-29 13:34:46 +04:00
Sebastián Ramírez 7b63bc5551
Add include, exclude, and by_alias to path operation methods (#264)
*  Make jsonable_encoder's include and exclude receive sequences

*  Add include, exclude, and by_alias to app and router

*  Add and update tutorial code with new parameters

* 📝 Update docs for new parameters and add docs for updating data

*  Add tests for consistency in path operation methods

*  Add tests for new parameters and update tests
2019-05-27 16:08:13 +04:00
William Hayes d8716f94ae Add skip_defaults support for path operations (for #242) (#248) 2019-05-25 19:35:57 +04:00
James Kaplan b087246f26 Add support for WebSockets with dependencies, params, etc #166 (#178) 2019-05-24 20:41:41 +04:00
Sebastián Ramírez e92b43b5c8
Add parameter dependencies to path operation decorators and include_router (#235)
*  Implement dependencies in decorator and .include_router

* 📝 Add docs for parameter dependencies

*  Add tests for dependencies parameter

* 🔥 Remove debugging prints in tests

* 📝 Update release notes
2019-05-16 18:07:00 +04:00
Sebastián Ramírez 3797c04946
Use 401 with WWW-Authenticate for OAuth2 and add scope_str (#188) 2019-04-27 17:00:56 +04:00
Sebastián Ramírez c1df0f6b84
Add docs and tests for Jinja2 templates (#186)
*  Add docs and tests for Jinja2 templates

* 🎨 Fix format in test, remove unused import
2019-04-26 18:49:15 +04:00
Sebastián Ramírez 528ef7e079
Docs and tests, responses with headers and cookies (#185) 2019-04-26 15:13:59 +04:00
Sebastián Ramírez c705685394
Add docs for HTTP Basic Auth and tests (#177) 2019-04-21 22:30:58 +04:00
Sebastián Ramírez 61dd36a945
Upgrade docstring Markdown parsing (#163)
*  Upgrade docstring Markdown parsing

* 📝 Update release notes
2019-04-16 22:49:18 +04:00
Sebastián Ramírez aad6b123f7
Add support for multi-file uploads (#158) 2019-04-14 22:12:14 +04:00
Sebastián Ramírez 84de980977
Add docs about responses with additional status codes (#156)
*  Add docs about responses with additional status codes

* 📝 Update docs, link to documenting additional responses
2019-04-12 22:43:21 +04:00
Sebastián Ramírez 88ece95a30
🎨 Improve automatic naming of path operations in API docs (#155)
* 🎨 Improve operation summary naming

* 📝 Update names in README

* 🚚 Improve names of security tutorial
2019-04-12 21:25:26 +04:00
Sebastián Ramírez 46e3811f8d
Add testing docs and tests (#151)
* ✏️ Fix typo in security intro

*  Add testing docs and tests

* 🐛 Debug Travis coverage

* 🐛 Debug Travis coverage, report XML

* 💚 Make Travis/Flit use same code install

*  Revert Travis/Codecov debugging changes
2019-04-12 20:15:05 +04:00
Sebastián Ramírez 7391056daf
Add OAuth2 scopes with SecurityScopes, upgrade Security (#141)
*  Upgrade OAuth2 Security with scopes handling

* 📝 Update Security tutorial with OAuth2 and JWT

*  Add tutorial code for OAuth2 with scopes (and JWT)

*  Add tests for tutorial/OAuth2 with scopes

* 🐛 Fix security_scopes type declaration

*  Add docs and tests for SecurityScopes
2019-04-09 23:29:04 +04:00
Sebastián Ramírez ad471307e2
Additional Responses (#97)
Add additional responses to OpenAPI, including Pydantic models or schemas directly, custom status codes, media types, extending `response_model`, etc.
2019-04-05 14:18:28 +04:00
Sebastián Ramírez 2bd775988f Add/refactor addditional responses, tests, docs 2019-04-05 13:54:00 +04:00
Sebastián Ramírez dd6ab23b62
Add docs/tests extending OpenAPI (#126) 2019-03-30 19:53:44 +04:00
Sebastián Ramírez dc1e94d05f
Document and test union and list response models (#108) 2019-03-25 23:28:09 +04:00
Sebastián Ramírez 1c2ecbb89a
Add docs and tests for encode/databases (#107)
*  Add docs and tests for encode/databases

*  Add testing-only dependency, databases
2019-03-25 22:17:31 +04:00
Sebastián Ramírez 9b04593260
Add support for BackgroundTasks parameters (#103)
*  Add support for BackgroundTasks parameters

* 🐛 Fix type declaration in dependencies

* 🐛 Fix coverage of util in tests
2019-03-24 23:33:35 +04:00
Sebastián Ramírez 834723cf2c
Add events docs and tests (#99) 2019-03-24 12:45:46 +04:00
Sebastián Ramírez c64f8346ae
Multi-value query parameters and duplicate headers (#95)
* 📝 Document multi-value query parameters

*  Document and test multiple query values

*  Document receiving duplicate headers
2019-03-22 21:47:54 +04:00
Sebastián Ramírez 0b9fe62a10
Add support for UploadFile class annotations (#63)
*  Add support for UploadFile annotations

* 📝 Update File upload docs with FileUpload class

*  Add tests for UploadFile support

* 📝 Update UploadFile docs
2019-03-03 20:52:37 +04:00
Sebastián Ramírez 8772e2f2ee
Add HTTPException with custom headers (#35)
* 📝 Update Release Notes with issue templates

*  Add HTTPException with support for headers

Including docs and tests

* 📝 Update Security docs to use new HTTPException
2019-02-16 17:01:29 +04:00
Kabir Khan 0ea0d0e82a Add Open API prefix route - correct docs behind reverse proxy (#26)
Add Open API prefix route - correct docs behind reverse proxy.
2019-02-14 22:57:49 +04:00
Sebastián Ramírez 955e9fcb31
Update fix SQLAlchemy support with ORM (#30)
 SQLAlchemy ORM support

Improved jsonable_encoder with SQLAlchemy support, tests running with SQLite, improved and updated SQL docs

*  Add SQLAlchemy to development dependencies (not required for using FastAPI)

*  Add sqlalchemy to testing dependencies (not required to use FastAPI)
2019-02-12 23:02:21 +04:00
Sebastián Ramírez d692c28f52 📝 Add docs for bigger applications and APIRouter
and update tests to match docs
2019-01-14 19:23:38 +04:00
Sebastián Ramírez 577c5a84db 🐛 Fix constrained bytes, from defaults in Pydantic
#2
2019-01-05 17:30:27 +04:00
Sebastián Ramírez 9a8349bf96 📝 Improve explanation of dependencies 2019-01-01 19:27:02 +04:00
Sebastián Ramírez c3e5e65093 🎨 Fix missing format 2018-12-28 16:11:45 +04:00
Sebastián Ramírez 804ec460fc ⬆️ Add tests, fix issues and update Pydantic 2018-12-28 16:10:29 +04:00
Sebastián Ramírez 6b9931f882 Add tests for metadata 2018-12-22 18:47:05 +04:00
Sebastián Ramírez 613c3f3e95 Test all HTTP methods 2018-12-22 18:18:19 +04:00
Sebastián Ramírez a73709507c Add docs, tests and fixes for extra data types
including refactor of jsonable_encoder to allow other object and model types
2018-12-22 14:35:48 +04:00
Sebastián Ramírez 3180f35bdd Fix OpenAPI test for body schema 2018-12-22 09:00:58 +04:00
Sebastián Ramírez d498b7feb3 Add tests for response_model 2018-12-22 08:54:52 +04:00
Sebastián Ramírez 3269e6a95c Test custom responses 2018-12-22 08:47:44 +04:00
Sebastián Ramírez f1808de18e Add tests for form and files 2018-12-22 08:39:26 +04:00
Sebastián Ramírez 748dc375db 🐛 Fix Form and File params must always be embeded
and add tests for forms and files
2018-12-22 08:24:48 +04:00
Sebastián Ramírez b38fb937b0 🔇 Remove debugging prints 2018-12-22 08:21:02 +04:00
Sebastián Ramírez c25a71e352 🐛 Re-implement check for body as a workaround
while encode/starlette#287 is merged
2018-12-22 07:40:56 +04:00
Sebastián Ramírez 4b94da956c Update query param tests and docs 2018-12-18 23:38:38 +04:00
Sebastián Ramírez b59e8ffcf6 🎨 Format tests for Cookies 2018-12-18 23:15:26 +04:00
Sebastián Ramírez 7f382127cc Add tests for body with Schema 2018-12-18 23:15:03 +04:00
Sebastián Ramírez 3513b039b9 Test cookies 2018-12-18 23:04:53 +04:00
Sebastián Ramírez 22dc7e9132 Test for missing required body 2018-12-18 22:57:09 +04:00
Sebastián Ramírez ae50492735 Add tests for header parameters 2018-12-18 22:33:59 +04:00
Sebastián Ramírez 00e2e544c7 ♻️ Re-format tutorials, files names and tests
for tutorial files
2018-12-18 21:59:06 +04:00