Ginodantic
Project description
Generate pydantic schema from gino models
Github: https://github.com/Basalex/ginodantic
- Meta Class Options
as_dataclass: bool -> pydantic dataclass will be used for generated schema
as_list_fields: Tuple[str] -> listed fields will be generated as List[type]
field_methods: bool -> int and float fields will be generated with postfix __ge, and postfix __le,
field_methods_by_name: Dict[str, List[str]] -> use database field names instead of model field names
fields: Tuple[str] -> only listed fields will be used for generated schema
field_methods: Tuple[str] -> excludes listed fields from generated schema
exclude: Tuple[str] -> excludes listed fields from generated schema
list_pk: bool -> Foreign key and primary key will be interpreted as list
required: Tuple[str] -> only listed fields will be defined as required, can be set as empty tuple
use_db_names: bool -> use database field names instead of model field names
Examples of usage:
from ginodantic import BaseModelSchema
class UserSchema(BaseModelSchema):
class Meta:
model: User
required: ()
exclude: ('email', )
use_db_names: False
field_methods_by_name = {'age': ('le', 'ge')}
class UserSchema(BaseModel):
id: Optional[int] = None
username: Optional[str] = None
age__le: Optional[str] = None
age__ge: Optional[str] = None
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
Hashes for ginodantic-0.1.0b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78e8554dcb62ea89308837fe79bff79befa16962c540feb7349738998489175b |
|
MD5 | 86205d1c381329322d76e517268bb5a6 |
|
BLAKE2b-256 | 58fb14bbbf8b4f94be08f1749c4b0d4563a2f64c68b3b65470a2133a4b63052b |