Skip to content

Add large binary, support for native pydantic fields, examples in openapi

Choose a tag to compare

@collerek collerek released this 02 May 13:14
· 1091 commits to master since this release
e564acb

0.10.6

✨ Features

  • Add LargeBinary(max_length) field type #166

  • Add support for normal pydantic fields (including Models) instead of pydantic_only
    attribute which is now deprecated #160.
    Pydantic fields should be declared normally as in pydantic model next to ormar fields,
    note that (obviously) ormar does not save and load the value for this field in
    database that mean that ONE of the following has to be true:

    • pydantic field declared on ormar model has to be Optional (defaults to None)
    • pydantic field has to have a default value set
    • pydantic field has default_factory function set
    • ormar.Model with pydantic field has to overwrite __init__() and provide the value there

    If none of the above ormar (or rather pydantic) will fail during loading data from the database,
    with missing required value for declared pydantic field.

  • Ormar provides now a meaningful examples in openapi schema, including nested models.
    The same algorithm is used to iterate related models without looks
    as with dict() and select/load_all. Examples appear also in fastapi. #157

🐛 Fixes

  • By default pydantic is not validating fields during assignment,
    which is not a desirable setting for an ORM, now all ormar.Models
    have validation turned-on during assignment (like model.column = 'value')

💬 Other

  • Add connecting to the database in QuickStart in readme #180
  • OpenAPI schema does no longer include ormar.Model docstring as description,
    instead just model name is provided if you do not provide your own docstring.
  • Some performance improvements.