// common/proto/table_validation.proto syntax = "proto3"; package komp_ac.table_validation; // Request validation rules for a table message GetTableValidationRequest { string profileName = 1; string tableName = 2; } // Response with field-level validations; if a field is omitted, // no validation is applied (default unspecified). message TableValidationResponse { repeated FieldValidation fields = 1; } // Field-level validation (extensible for future kinds) message FieldValidation { // MUST match your frontend FormState.dataKey for the column string dataKey = 1; // Current: only CharacterLimits. More rules can be added later. CharacterLimits limits = 10; // Future expansion: // PatternRules pattern = 11; DisplayMask mask = 3; // ExternalValidation external = 13; // CustomFormatter formatter = 14; bool required = 4; } // Character length counting mode enum CountMode { COUNT_MODE_UNSPECIFIED = 0; // default: same as CHARS CHARS = 1; BYTES = 2; DISPLAY_WIDTH = 3; } // Character limit validation (Validation 1) message CharacterLimits { // When zero, the field is considered "not set". If both min/max are zero, // the server should avoid sending this FieldValidation (no validation). uint32 min = 1; uint32 max = 2; // Optional warning threshold; when unset, no warning threshold is applied. optional uint32 warnAt = 3; CountMode countMode = 4; // defaults to CHARS if unspecified } // Mask for pretty display message DisplayMask { string pattern = 1; // e.g., "(###) ###-####" or "####-##-##" string input_char = 2; // e.g., "#" optional string template_char = 3; // e.g., "_" } // Service to fetch validations for a table service TableValidationService { rpc GetTableValidation(GetTableValidationRequest) returns (TableValidationResponse); rpc UpdateFieldValidation(UpdateFieldValidationRequest) returns (UpdateFieldValidationResponse); } message UpdateFieldValidationRequest { string profileName = 1; string tableName = 2; string dataKey = 3; FieldValidation validation = 4; } message UpdateFieldValidationResponse { bool success = 1; string message = 2; }