Skip to content

Commit ded059d

Browse files
committed
fix(client): remove schema_mode from create_edge_type — proto field absent
CreateEdgeTypeRequest does not have a schema_mode field in the current proto (only CreateLabelRequest supports it). Passing schema_mode caused "Protocol message has no field" at runtime. Remove the parameter entirely; add a docstring note that schema_mode for edge types is planned for a future server release.
1 parent 62ea048 commit ded059d

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

coordinode/coordinode/client.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,7 @@ async def create_label(
570570
async def create_edge_type(
571571
self,
572572
name: str,
573-
properties: list[dict[str, Any]] | None = None,
574-
*,
575-
schema_mode: str | int = "strict",
573+
properties: list[dict[str, Any]] | tuple[dict[str, Any], ...] | None = None,
576574
) -> EdgeTypeInfo:
577575
"""Create an edge type in the schema registry.
578576
@@ -581,30 +579,22 @@ async def create_edge_type(
581579
properties: Optional list of property dicts with keys
582580
``name`` (str), ``type`` (str), ``required`` (bool),
583581
``unique`` (bool). Same type strings as :meth:`create_label`.
584-
schema_mode: ``"strict"`` (default — reject undeclared props),
585-
``"validated"`` (warn on extras), or ``"flexible"`` (allow any
586-
prop without declaration). Case-insensitive; leading/trailing
587-
whitespace is stripped.
582+
583+
Note:
584+
``schema_mode`` is not yet supported by the server for edge types
585+
(``CreateEdgeTypeRequest`` does not carry that field). Schema
586+
mode enforcement for edge types is planned for a future release.
588587
"""
589588
from coordinode._proto.coordinode.v1.graph.schema_pb2 import ( # type: ignore[import]
590589
CreateEdgeTypeRequest,
591590
PropertyDefinition,
592591
PropertyType,
593-
SchemaMode,
594592
)
595593

596-
_mode_map = {
597-
"strict": SchemaMode.SCHEMA_MODE_STRICT,
598-
"validated": SchemaMode.SCHEMA_MODE_VALIDATED,
599-
"flexible": SchemaMode.SCHEMA_MODE_FLEXIBLE,
600-
}
601-
proto_schema_mode = self._normalize_schema_mode(schema_mode, _mode_map)
602-
603594
proto_props = self._build_property_definitions(properties, PropertyType, PropertyDefinition)
604595
req = CreateEdgeTypeRequest(
605596
name=name,
606597
properties=proto_props,
607-
schema_mode=proto_schema_mode,
608598
)
609599
et = await self._schema_stub.CreateEdgeType(req, timeout=self._timeout)
610600
return EdgeTypeInfo(et)
@@ -973,12 +963,10 @@ def create_label(
973963
def create_edge_type(
974964
self,
975965
name: str,
976-
properties: list[dict[str, Any]] | None = None,
977-
*,
978-
schema_mode: str | int = "strict",
966+
properties: list[dict[str, Any]] | tuple[dict[str, Any], ...] | None = None,
979967
) -> EdgeTypeInfo:
980968
"""Create an edge type in the schema registry."""
981-
return self._run(self._async.create_edge_type(name, properties, schema_mode=schema_mode))
969+
return self._run(self._async.create_edge_type(name, properties))
982970

983971
def create_text_index(
984972
self,

0 commit comments

Comments
 (0)