Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://nf1s.github.io/fastapi-camelcase/
Package for providing a class for camelizing request and response bodies for fastapi while keeping your python code snake cased.
https://nf1s.github.io/fastapi-camelcase/
fastapi fastapi-camelcase python python3 python36 rest-api
Last synced: 13 days ago
JSON representation
Package for providing a class for camelizing request and response bodies for fastapi while keeping your python code snake cased.
- Host: GitHub
- URL: https://nf1s.github.io/fastapi-camelcase/
- Owner: nf1s
- License: mit
- Created: 2020-02-29T12:21:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-09T11:56:45.000Z (11 months ago)
- Last Synced: 2024-10-01T11:50:01.603Z (about 1 month ago)
- Topics: fastapi, fastapi-camelcase, python, python3, python36, rest-api
- Language: JavaScript
- Homepage: https://ahmednafies.github.io/fastapi_camelcase/
- Size: 1.14 MB
- Stars: 71
- Watchers: 4
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-fastapi - FastAPI-CamelCase - CamelCase JSON support for FastAPI utilizing [Pydantic](https://pydantic-docs.helpmanual.io/). (Third-Party Extensions / Databases)
- awesome-fastapi - FastAPI-CamelCase - CamelCase JSON support for FastAPI utilizing [Pydantic](https://docs.pydantic.dev/latest/). (Third-Party Extensions / Databases)
README
[![CircleCI](https://circleci.com/gh/nf1s/fastapi-camelcase.svg?style=shield)](https://circleci.com/gh/nf1s/fastapi-camelcase) [![codecov](https://codecov.io/gh/nf1s/fastapi-camelcase/branch/master/graph/badge.svg)](https://codecov.io/gh/nf1s/fastapi-camelcase) [![Downloads](https://pepy.tech/badge/fastapi-camelcase)](https://pepy.tech/project/fastapi-camelcase) ![GitHub Pipenv locked Python version](https://img.shields.io/github/pipenv/locked/python-version/nf1s/fastapi-camelcase) ![GitHub](https://img.shields.io/github/license/nf1s/fastapi-camelcase)
# 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](https://nf1s.github.io/fastapi-camelcase/)
## How to install
```bash
pip install fastapi-camelcase
```## Dependencies
pydantic
pyhumps## How to use
```python
# using CamelModel instead of Pydantic BaseModel
from fastapi_camelcase import CamelModelclass User(CamelModel):
first_name: str
last_name: str
age: int
```## How to use (full example)
```python
import uvicorn
from fastapi import FastAPI
from fastapi_camelcase import CamelModelclass User(CamelModel):
first_name: str
last_name: str
age: intapp = 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 userif __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
```