Skip to content

Releases: Fatal1ty/mashumaro

v3.8

22 Jun 18:45
Compare
Choose a tag to compare

Changes

  • Added new Discriminator type for discriminated unions and subclasses support, see documentation (#106)
  • Added ability to pass custom context from to_* methods to the hooks, see documentation (#110)
  • Types enclosed in Annotated are now different from unenclosed ones in serialization_strategy, see documentation (#115)
  • Added new lazy_compilation config option that can reduce import time and speed up deserialization, see documentation
  • Added support for Final types (#107)
  • Fixed support for Literal on Python 3.9.0 (#103)
  • Added workaround for mypy problem python/mypy#3186 in JSON Schema number constraints
  • Fixed type substitutions in generic SerializableType when TypeVars were mixed with ordinary types in _serialize / _deserialize annotations
  • Fixed an issue where a sentinel value dataclasses.KW_ONLY resulted in UnserializableDataError
  • Fixed an issue where passing a user-defined dict-like object to from_dict method could result in unhandled exceptions
  • Speeded up dataclass instantiation
  • Speeded up deserialization of fields with default values if they are missing in the input data

v3.7

13 Apr 17:56
Compare
Choose a tag to compare

Changes

  • Added "omit" serialization engine to skip the field during serialization
  • Added ref_prefix parameter to build_json_schema and JSONSchemaBuilder to change reference prefix
  • Fixed adding dataclass field alias to JSON Schema "required" keyword value. See #101.

v3.6

07 Apr 09:28
Compare
Choose a tag to compare

Changes

  • Added JSON Schema generation functionality 🎉 (see documentation)
    • Draft 2022-12 and OpenAPI Specification 3.1.0
    • Validation keywords using typing.Annotated
    • No mixin required

v3.5

13 Feb 10:37
Compare
Choose a tag to compare

Changes

  • Added possibility to define a generic serialization method for a generic type by registering a method for its origin type
  • Improved support for third-party generic types by writing a generic SerializationStrategy (details)
  • Improved writing SerializationStrategy methods by optional use_annotations=True (details)
  • Classes defining __class_getitem__ methods will now be treated as generic types according to PEP 560

v3.4

06 Feb 08:37
Compare
Choose a tag to compare

Changes

  • Added support for typing.DefaultDict / collections.defaultdict
  • Added support for generic TypedDict and generic NamedTuple
  • Speeded up the generated code for deserialization of fields that could be None

v3.3.1

10 Jan 13:41
Compare
Choose a tag to compare

Changes

  • Fixed UnresolvedTypeReferenceErrorwhen postponed annotations were used and parent generic dataclass was defined in different module. See #90.
  • Fixed recursion error for self-referenced generic dataclasses. See #91.
  • Fixed inconsistent application of serialization_strategy appeared in version 3.2. See #93.

v3.3

21 Dec 23:50
Compare
Choose a tag to compare

Changes

  • Added ability to use annotations inside SerializableType to simplify dealing with generic types (see updated documentation)
  • Added support for user-defined variadic generic types and dataclasses, TypeVarTuple and Unpack from PEP 646
  • Fixed serialization / deserialization of Tuple[()] on python 3.11
  • Changed type name for Tuple[T, ...] from "Tuple[T, Ellipsis]" to "Tuple[T, ...]"

v3.2

02 Dec 22:18
Compare
Choose a tag to compare

Changes

  • Added support for PEP 655
  • Added skipping None value fields on serialization to TOML format. See #85.
  • Added new omit_none config option
  • Added new omit_none dialect option
  • Removed allowance to pass None values to fields that can't be None according to their type
  • Speeded up the generated code
  • Dropped Python 3.6 support

v3.1.1

29 Nov 21:28
Compare
Choose a tag to compare

Changes

  • Fixed using compiled mixins with inheritance. See #87.

v3.1

19 Oct 15:20
Compare
Choose a tag to compare

Changes

  • Added support for Python 3.11
  • Added support for typing.Self and typing_extensions.Self
  • In addition to from_dict and to_dict, methods in other mixins can also be compiled now
  • Increased speed of serialization and deserialization in MessagePack when using DataClassMessagePackMixin:
    • Removed the implicit inclusion of the ADD_DIALECT_SUPPORT config option when using DataClassMessagePackMixin
    • Methods from_msgpack and to_msgpack are now compiled
  • Added DataClassORJSONMixin to use a third-party orjson library that will handle supported data types by itself
    • Added new orjson_options config option to change default options passing to orjson.dumps method
    • Methods to_jsonb and to_json have orjson_options keyword argument to override the default options
  • Added support for TOML format using DataClassTOMLMixin