Compare commits
3 Commits
339d06ce7e
...
1cedd58708
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cedd58708 | ||
|
|
7f7ebd3ad6 | ||
|
|
9f6d480aee |
2
canvas
2
canvas
Submodule canvas updated: 29fdc5a6c7...6f1cda36d8
2
client
2
client
Submodule client updated: c1839bd960...615c317a66
@@ -20,6 +20,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
".komp_ac.table_validation.TableValidationResponse",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_validation.PatternRule",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_validation.PatternRules",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_validation.CustomFormatter",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".komp_ac.table_validation.UpdateFieldValidationRequest",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
|
||||
@@ -22,7 +22,8 @@ message FieldValidation {
|
||||
// Current: only CharacterLimits. More rules can be added later.
|
||||
CharacterLimits limits = 10;
|
||||
// Future expansion:
|
||||
// PatternRules pattern = 11;
|
||||
PatternRules pattern = 11; // Validation 2
|
||||
optional CustomFormatter formatter = 14; // Validation 4 – custom formatting logic
|
||||
DisplayMask mask = 3;
|
||||
// ExternalValidation external = 13;
|
||||
// CustomFormatter formatter = 14;
|
||||
@@ -57,6 +58,40 @@ message DisplayMask {
|
||||
optional string template_char = 3; // e.g., "_"
|
||||
}
|
||||
|
||||
// One position‑based validation rule, similar to CharacterFilter + PositionRange
|
||||
message PatternRule {
|
||||
// Range descriptor: how far the rule applies
|
||||
// Examples:
|
||||
// - "0" → Single position 0
|
||||
// - "0-3" → Range 0..3 inclusive
|
||||
// - "from:5" → From position 5 onward
|
||||
// - "0,2,5" → Multiple discrete positions
|
||||
string range = 1;
|
||||
|
||||
// Character filter type, case‑insensitive keywords:
|
||||
// "ALPHABETIC", "NUMERIC", "ALPHANUMERIC",
|
||||
// "ONEOF(<chars>)", "EXACT(:)", "CUSTOM(<name>)"
|
||||
string filter = 2;
|
||||
}
|
||||
|
||||
message CustomFormatter {
|
||||
// Formatter type identifier; handled client‑side.
|
||||
// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter"
|
||||
string type = 1;
|
||||
|
||||
// Optional free‑text note or parameters (e.g. locale, pattern)
|
||||
optional string description = 2;
|
||||
}
|
||||
|
||||
// Collection of pattern rules for one field
|
||||
message PatternRules {
|
||||
// All rules that make up the validation logic
|
||||
repeated PatternRule rules = 1;
|
||||
|
||||
// Optional human‑readable description for UI/debug purposes
|
||||
optional string description = 2;
|
||||
}
|
||||
|
||||
// Service to fetch validations for a table
|
||||
service TableValidationService {
|
||||
rpc GetTableValidation(GetTableValidationRequest)
|
||||
|
||||
Binary file not shown.
@@ -26,7 +26,13 @@ pub struct FieldValidation {
|
||||
#[prost(message, optional, tag = "10")]
|
||||
pub limits: ::core::option::Option<CharacterLimits>,
|
||||
/// Future expansion:
|
||||
/// PatternRules pattern = 11;
|
||||
///
|
||||
/// Validation 2
|
||||
#[prost(message, optional, tag = "11")]
|
||||
pub pattern: ::core::option::Option<PatternRules>,
|
||||
/// Validation 4 – custom formatting logic
|
||||
#[prost(message, optional, tag = "14")]
|
||||
pub formatter: ::core::option::Option<CustomFormatter>,
|
||||
#[prost(message, optional, tag = "3")]
|
||||
pub mask: ::core::option::Option<DisplayMask>,
|
||||
/// ExternalValidation external = 13;
|
||||
@@ -65,6 +71,46 @@ pub struct DisplayMask {
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub template_char: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
/// One position‑based validation rule, similar to CharacterFilter + PositionRange
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct PatternRule {
|
||||
/// Range descriptor: how far the rule applies
|
||||
/// Examples:
|
||||
/// - "0" → Single position 0
|
||||
/// - "0-3" → Range 0..3 inclusive
|
||||
/// - "from:5" → From position 5 onward
|
||||
/// - "0,2,5" → Multiple discrete positions
|
||||
#[prost(string, tag = "1")]
|
||||
pub range: ::prost::alloc::string::String,
|
||||
/// Character filter type, case‑insensitive keywords:
|
||||
/// "ALPHABETIC", "NUMERIC", "ALPHANUMERIC",
|
||||
/// "ONEOF(<chars>)", "EXACT(:)", "CUSTOM(<name>)"
|
||||
#[prost(string, tag = "2")]
|
||||
pub filter: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CustomFormatter {
|
||||
/// Formatter type identifier; handled client‑side.
|
||||
/// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter"
|
||||
#[prost(string, tag = "1")]
|
||||
pub r#type: ::prost::alloc::string::String,
|
||||
/// Optional free‑text note or parameters (e.g. locale, pattern)
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub description: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
/// Collection of pattern rules for one field
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct PatternRules {
|
||||
/// All rules that make up the validation logic
|
||||
#[prost(message, repeated, tag = "1")]
|
||||
pub rules: ::prost::alloc::vec::Vec<PatternRule>,
|
||||
/// Optional human‑readable description for UI/debug purposes
|
||||
#[prost(string, optional, tag = "2")]
|
||||
pub description: ::core::option::Option<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct UpdateFieldValidationRequest {
|
||||
|
||||
Reference in New Issue
Block a user