From 3716255d8f5ad36ec199f72624abd754348ff412 Mon Sep 17 00:00:00 2001 From: Future-Outlier Date: Wed, 18 Sep 2024 15:11:48 +0800 Subject: [PATCH] update Yee's advice Signed-off-by: Future-Outlier --- rfc/system/5741-binary-idl-with-message-pack.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rfc/system/5741-binary-idl-with-message-pack.md b/rfc/system/5741-binary-idl-with-message-pack.md index c0b5706cb3..ae04b0903f 100644 --- a/rfc/system/5741-binary-idl-with-message-pack.md +++ b/rfc/system/5741-binary-idl-with-message-pack.md @@ -420,10 +420,18 @@ Note: We will use mashumaro's `MessagePackEncoder` and `MessagePackDecoder` to s from mashumaro.codecs.msgpack import MessagePackDecoder, MessagePackEncoder ``` +#### Literal Type's TypeStructure's dataclass_type +This is used for compiling dataclass attribute access. + +With it, we can retrieve the literal type of an attribute and validate it in Flyte's propeller compiler. + +For more details, check here: https://github.com/flyteorg/flytekit/blob/fb55841f8660b2a31e99381dd06e42f8cd22758e/flytekit/core/type_engine.py#L454-L525 + #### JSON Schema The JSON Schema of `dataclass` will be generated by `marshmallow` or `mashumaro`. Check here: https://github.com/flyteorg/flytekit/blob/8c6f6f0f17d113447e1b10b03e25a34bad79685c/flytekit/core/type_engine.py#L442-L474 + ### Pydantic Transformer #### Literal Value Pydantic can't be serialized to `msgpack bytes` directly. @@ -455,6 +463,13 @@ my_dc = MyDCModel(dc=DC(a=1, b=2.0, c="3", d={"4": 5}, e=DC_inside(a=6, b=7.0))) # {'dc': {'a': 1, 'b': 2.0, 'c': '3', 'd': {'4': 5}, 'e': {'a': 6, 'b': 7.0}}} ``` +#### Literal Type's TypeStructure's dataclass_type +This is used for compiling Pydantic BaseModel attribute access. + +With it, we can retrieve an attribute's literal type and validate it in Flyte's propeller compiler. + +Although this feature is not currently implemented, it will function similarly to the dataclass transformer in the future. + #### JSON Schema The JSON Schema of `BaseModel` will be generated by Pydantic's API. ```python