Fastapi Camelcase
Package for providing a class for camelizing request and response bodies for fastapi while keeping your python code snake cased.
Full documentation can be found here
How to install
pip install fastapi-camelcase
Dependencies
pydantic
pyhumps
How to use
# using CamelModel instead of Pydantic BaseModel
from fastapi_camelcase import CamelModel
class User(CamelModel):
first_name: str
last_name: str
age: int
How to use (full example)
import uvicorn
from fastapi import FastAPI
from fastapi_camelcase import CamelModel
class User(CamelModel):
first_name: str
last_name: str
age: int
app = FastAPI()
@app.get("/user/get", response_model=User)
async def get_user():
return User(first_name="John", last_name="Doe", age=30)
@app.post("/user/create", response_model=User)
async def create_user(user: User):
return user
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
Metadata
Release files for fastapi-camelcase 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_camelcase-2.0.0.tar.gz | 3.5 kB | Details |
Release files / fastapi_camelcase-2.0.0.tar.gz
| Download URL | fastapi_camelcase-2.0.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96925a604778b36784a68aeae4ecbbc04936cf4b7f4a09a26ca6292ab2849929
|
|
BLAKE2b-256 checksum How to use checksums |
bad3aa53e6b3447bec5326dfc246b5705eac3d0ada961fc60144f7a482358765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.9
|