70 Commits

Author SHA1 Message Date
Sebastián Ramírez e0c3519b94 ✨ Allow callables (as functools.partial) in path operations (#977) 2020-02-12 21:36:14 +01:00
Sebastián Ramírez 7cea84b74c 🐛 Fix FastAPI serialization of Pydantic ORM mode blocking the event loop (#888) 2020-01-18 17:32:57 +01:00
Aviram Hassan 5db99a27cf ✨ add body to RequestValidationError for easier debugging (#853) 2020-01-17 12:37:44 +01:00
James Kaplan cb1410426e 🐛 Fix callback handling in sub-routers (#792) 2020-01-08 22:22:14 +01:00
Ben Dayan 73260971b5 ✨ Add support for OpenAPI Callbacks (#722) 2019-12-11 17:58:00 +01:00
Sebastián Ramírez 83d04df8a6 🔊 Refactor logging (#781) 2019-12-09 20:02:44 +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
Daniel Brotsky c7902dd23a ✨ Generate correct OpenAPI docs for responses with no content (#621) 2019-11-24 14:15:39 +01:00
dmontagu 8c3ef76139 ✨ Add better support for request body access/manipulation with custom classes (#589) 2019-10-04 19:23:34 -05:00
dmontagu dd963511d6 🐛 Fix preserving route_class when calling include_router (#538) 2019-10-04 16:35:20 -05:00
svalouch c7dc26b760 ✨ Allow docstrings to be truncated before being used for OpenAPI (#556) 2019-10-04 15:02:40 -05:00
toppk f803c77515 ✨ Add support for specifying a default_response_class (#467) 2019-09-29 16:47:35 -05:00
dmontagu fc7d123347 ⬆️ Upgrade support to Pydantic version 0.32.2 (breaking change) (#463) 2019-08-30 19:30:03 -05:00
dmontagu c70f3f1198 ✨ Add support for custom route class (#468) 2019-08-30 19:05:59 -05:00
dmontagu 6c6bdb6233 🔒 Ensure skip_defaults doesn't cause extra fields to be serialized (#485) 2019-08-30 18:56:14 -05:00
dmontagu 38495fffa5 🐛 Fix skip_defaults implementation when returning a Pydantic model (#422) 2019-08-26 08:24:58 -05:00
Sebastián Ramírez e71636e381 🐛 Fix mypy route errors after merging #415 (#462) 2019-08-24 20:05:44 -05:00
Vitaliy Kucheryaviy f7f17fcfd6 ✨ Allow empty routed path (issue #414) (#415) 2019-08-24 19:39:48 -05:00
Pablo Marti 0c55553328 ✏️ Fix typo in assert statement (#419) 2019-08-07 14:03:11 -05: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 dcc1e1bcf8 ♻️ Refine internal type declarations and logic around them (#338) 2019-06-27 20:51:17 +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
dmontagu 87b7a63ff2 🔥 Remove unused regex in routing.py (#314) 2019-06-18 13:52:34 +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 bff5dbbf5d ✨ Implement dependency value cache per request (#292)
* ✨ Add dependency cache, with support for disabling it

* ✅ Add tests for dependency cache

* 📝 Add docs about dependency value caching
2019-06-05 21:00:54 +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 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 a49d45eaa9 🐛 Fix response_model type to allow List[Model] (#266) 2019-05-27 21:56:20 +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
Ricardo Momm b0b88f9d5b 🔊 Raise from previous exception (#195) 2019-05-15 14:50:58 +04:00
Derek J. Lambert 4a1648b04e ✏️ Minor spelling fix in routing (#221) 2019-05-14 22:04:18 +04:00
Sebastián Ramírez 192ebba2a2 ♻️ Rename parameter content_type to response_class (#183) 2019-04-26 13:11:16 +04:00
Sebastián Ramírez 546d233dec ♻️ Update Pydantic usage, types, values, minor structure changes (#164) 2019-04-16 23:26:09 +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 c8df3ae57c 🐛 Fix handling additional responses in include_router (#140) 2019-04-05 20:06:40 +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 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
euri10 6d77e2ac5f ✨ Add websocket to APIRouter (#100)
* Add websocket to APIRouter

* Restore upstream/master Pipfile.lock (git checkout upstream/master -- Pipfile.lock)

* Added tests for router with a prefix
2019-03-24 23:18:20 +04:00
Mohammed eda9b28338 files formatting 2019-03-23 13:10:45 +03:00
Mohammed 7514ac6fb0 100% test coverage 2019-03-23 13:01:53 +03:00
Mohammed 65568065e0 Remove extra code. 2019-03-23 00:47:32 +03:00
Mohammed 95679ca5e6 Fix: adding additional_responses on .include_router() 2019-03-23 00:37:10 +03:00
Mohammed 84a300ef84 Formatting according to guide 2019-03-22 22:54:48 +03:00
Mohammed c6d28c8209 Accept Multiple Additional Responses 2019-03-22 22:50:47 +03:00