Pydantic validation for Sanic framework
Project description
sanicpydantic
Pydantic validation for Sanic framework
Install:
pip install sanicpydantic
Example:
from pydantic import BaseModel
from sanic_pydantic import RequestValidator
validator = RequestValidator()
...
class QueryModel(BaseModel):
str_param: str
int_param: int
bool_param: bool
@app.get('/')
@validator(query_schema=QueryModel)
def get_endpoint(request, query_: QueryModel):
...
class JsonModel(BaseModel):
str_field: str
int_field: int
bool_field: bool
@app.post('/')
@validator(json_schema=JsonModel)
def post_endpoint(request, json_: JsonModel):
...
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
sanicpydantic-0.0.3.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for sanicpydantic-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c761d73b82e854af97019dca804f762ae38c485cb63b0fe6eb38dd639208e90a |
|
MD5 | cafc5fbb07309848f256953c843bfbbf |
|
BLAKE2b-256 | 78039811129547ff9829fd75366bf879505b85e57a037bb96dfa1f62bf873e5e |