validateEdgeType function

void validateEdgeType(
  1. String edgeType
)

Validates an edge type for security and correctness.

Edge types must start with an uppercase letter, contain only uppercase letters, digits, and underscores, and be 1-50 characters long. Mirrors Python's validate_edge_type.

Throws an EdgeTypeValidationError if the edge type is invalid.

Implementation

void validateEdgeType(String edgeType) {
  if (!_edgeTypePattern.hasMatch(edgeType)) {
    throw EdgeTypeValidationError(
      "Invalid edge_type '$edgeType'. Must start with uppercase letter, "
      'contain only uppercase letters, digits, underscores, and be 1-50 chars.',
    );
  }
}