From 621c9ba24173987a65d3c910b3f021284ee1fd4f Mon Sep 17 00:00:00 2001 From: Future-Outlier Date: Thu, 21 Nov 2024 21:51:37 +0800 Subject: [PATCH] format Signed-off-by: Future-Outlier --- docs/user_guide/data_types_and_io/dataclass.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/user_guide/data_types_and_io/dataclass.md b/docs/user_guide/data_types_and_io/dataclass.md index a26afc4183..f2f5b3f8a4 100644 --- a/docs/user_guide/data_types_and_io/dataclass.md +++ b/docs/user_guide/data_types_and_io/dataclass.md @@ -12,20 +12,22 @@ Flytekit uses the [Mashumaro library](https://github.com/Fatal1ty/mashumaro) to serialize and deserialize dataclasses. With the 1.14 release, `flytekit` adopted `MessagePack` as the -serialization format for dataclasses, overcoming a major limitation of serialization into a JSON string within a Protobuf `struct` datatype, like the previous versions do: +serialization format for dataclasses, overcoming a major limitation of serialization into a JSON string within a Protobuf `struct` datatype, like the previous versions do: to store `int` types, Protobuf's `struct` converts them to `float`, forcing users to write boilerplate code to work around this issue. :::{important} - If you're serializing dataclasses using `flytekit` version >= v1.14.0, and you want to produce Protobuf `struct literal` instead, you can set environment variable `FLYTE_USE_OLD_DC_FORMAT` to `true`. +::: + :::{important} If you're using Flytekit version < v1.11.1, you will need to add `from dataclasses_json import dataclass_json` to your imports and decorate your dataclass with `@dataclass_json`. ::: +:::{important} Flytekit version < v1.14.0 will produce protobuf struct literal for dataclasses. Flytekit version >= v1.14.0 will produce msgpack bytes literal for dataclasses.