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):
...
Release files for sanicpydantic 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sanicpydantic-0.0.3.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sanicpydantic-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.6 kB
Release files / sanicpydantic-0.0.3.tar.gz
| Download URL | sanicpydantic-0.0.3.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1972d8fc50f9b1fe4c0b0921bd9f7a72c1d6e00f4ed00ce39899ac6e8e58b42
|
|
BLAKE2b-256 checksum How to use checksums |
f710165b152276cb4ab36e76509a75695065eb8a530fd19b8f46d7faeca6e501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / sanicpydantic-0.0.3-py3-none-any.whl
| Download URL | sanicpydantic-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c761d73b82e854af97019dca804f762ae38c485cb63b0fe6eb38dd639208e90a
|
|
BLAKE2b-256 checksum How to use checksums |
78039811129547ff9829fd75366bf879505b85e57a037bb96dfa1f62bf873e5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|