Skip to content

v0.9.0 - Beta version of Models converter

Compare
Choose a tag to compare
@xnuinside xnuinside released this 14 Aug 22:30
· 39 commits to main since this release

Features:

  1. Added beta models converter from one type of models to another.
    To use models convertor:
from omymodels import convert_models


models_from = """

class MaterialType(str, Enum):

    article = "article"
    video = "video"


@dataclass
class Material:

    id: int
    title: str
    description: str
    link: str
    type: MaterialType
    additional_properties: Union[dict, list]
    created_at: datetime.datetime
    updated_at: datetime.datetime

"""

result = convert_models(models_from, models_type="gino")
print(result)

where models_type - type of models that you want to get as a result

  1. Now if O!MyModels does not know how to convert type - he just leave it as is.

Fixes:

  1. In Dataclass & Pydantic generators now Decimals & Floats converted to float (previously was int).