fix graph edges in geometry endpoint (hopefully)

the graph edge and geometry schemas are similar and pydantic matches graph edges as geometries if graph edges aren't first in the union types, which makes the from and to nodes disappear
This commit is contained in:
Gwendolyn 2023-12-21 14:43:57 +01:00
parent d6f234cf1f
commit b776a7be29

View file

@ -67,6 +67,10 @@ class EditorGeometriesGraphEdgePropertiesSchema(BaseSchema):
type: Literal["graphedge"]
from_node: EditorID
to_node: EditorID
color: Union[
Annotated[str, APIField(title="color")],
Annotated[None, APIField(title="no color")]
] = None
class EditorGeometriesGraphEdgeElemSchema(BaseSchema):
@ -87,8 +91,8 @@ class EditorGeometriesGeometryElemSchema(BaseSchema):
EditorGeometriesElemSchema = Union[
EditorGeometriesUpdateCacheKeyElem,
Annotated[EditorGeometriesGeometryElemSchema, APIField(title="a geometry object")],
Annotated[EditorGeometriesGraphEdgeElemSchema, APIField(title="a graph edge")],
Annotated[EditorGeometriesGeometryElemSchema, APIField(title="a geometry object")],
EditorGeometriesCacheReferenceElem,
]