dify/api/core/workflow/graph_engine
QuantumGhost 2c1ab4879f
refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025)
refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025)

This PR addresses serialization issues in the VariablePool model by separating the `value_type` tags for `IntegerSegment`/`FloatSegment` and `IntegerVariable`/`FloatVariable`. Previously, both Integer and Float types shared the same `SegmentType.NUMBER` tag, causing conflicts during serialization.

Key changes:
- Introduce distinct `value_type` tags for Integer and Float segments/variables
- Add `VariableUnion` and `SegmentUnion` types for proper type discrimination
- Leverage Pydantic's discriminated union feature for seamless serialization/deserialization
- Enable accurate serialization of data structures containing these types

Closes #22024.
2025-07-16 12:31:37 +08:00
..
condition_handlers feat: mypy for all type check (#10921) 2024-12-24 18:38:51 +08:00
entities refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
__init__.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
graph_engine.py refactor(graph_engine): Take GraphRuntimeState out of GraphEngine (#21882) 2025-07-07 13:15:18 +08:00