A wrapper around FastAPI's Depends function that infers its return type from its input
Project description
FastAPI inferring Depends
A wrapper around FastAPI's Depends function that infers its return type from its input
Example
from fastapi_inferring_depends import Depends
from fastapi import FastAPI
router = FastAPI()
async def answer_to_everything_dependency():
return 42
@app.get("/answer")
async def get_answer_to_everything(
answer_to_everything=Depends(answer_to_everything_dependency),
):
# type of answer_to_everything is 'int' (inferred from dependency)
return {"answer": answer_to_everything}
For more examples, look at the test/example file for all supported inferences.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi_inferring_depends-1.0.0.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c24e8a87971934559e692e8559cb2e76be976578c613473d4f50dcedb5e60cf7 |
|
MD5 | 9577b5dc5deadbdea46a0f852b634f62 |
|
BLAKE2b-256 | f57d4389678da308871611729578f6f99b7d3583f4b738ba8da701bddf670c45 |
Close
Hashes for fastapi_inferring_depends-1.0.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f47a86493149c1178440e0369605feef1fe6d193c004e432dc28e15449e21be |
|
MD5 | 38474d832146d610f12118d27275bcfe |
|
BLAKE2b-256 | 02df14d1649aef6e1a85098ebf8e080f992a35a0d3085ff00d14368681e73167 |