57 lines
1.6 KiB
Protocol Buffer
57 lines
1.6 KiB
Protocol Buffer
// common/proto/table_validation.proto
|
|
syntax = "proto3";
|
|
package komp_ac.table_validation;
|
|
|
|
// Request validation rules for a table
|
|
message GetTableValidationRequest {
|
|
string profile_name = 1;
|
|
string table_name = 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.data_key for the column
|
|
string data_key = 1;
|
|
|
|
// Current: only CharacterLimits. More rules can be added later.
|
|
CharacterLimits limits = 10;
|
|
// Future expansion:
|
|
// PatternRules pattern = 11;
|
|
// DisplayMask mask = 12;
|
|
// ExternalValidation external = 13;
|
|
// CustomFormatter formatter = 14;
|
|
}
|
|
|
|
// 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 warn_at = 3;
|
|
|
|
CountMode count_mode = 4; // defaults to CHARS if unspecified
|
|
}
|
|
|
|
// Service to fetch validations for a table
|
|
service TableValidationService {
|
|
rpc GetTableValidation(GetTableValidationRequest)
|
|
returns (TableValidationResponse);
|
|
}
|