Skip to content

Commit

Permalink
update Yee's advice
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <[email protected]>
  • Loading branch information
Future-Outlier committed Sep 18, 2024
1 parent b6dfb33 commit 3716255
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions rfc/system/5741-binary-idl-with-message-pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3716255

Please sign in to comment.