Compare commits

...

3 Commits

Author SHA1 Message Date
Priec
1cedd58708 serialization and gitignore in canvas 2025-12-18 20:04:03 +01:00
Priec
7f7ebd3ad6 Update client submodule pointer 2025-11-22 23:31:42 +01:00
Priec
9f6d480aee added validation2, NEXT DO GRPCURL TESTING OF THE VALIDATIONS 2025-11-21 23:17:16 +01:00
7 changed files with 98 additions and 4 deletions

2
canvas

Submodule canvas updated: 29fdc5a6c7...6f1cda36d8

2
client

Submodule client updated: c1839bd960...615c317a66

View File

@@ -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)]",

View File

@@ -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 positionbased 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, caseinsensitive keywords:
// "ALPHABETIC", "NUMERIC", "ALPHANUMERIC",
// "ONEOF(<chars>)", "EXACT(:)", "CUSTOM(<name>)"
string filter = 2;
}
message CustomFormatter {
// Formatter type identifier; handled clientside.
// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter"
string type = 1;
// Optional freetext 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 humanreadable 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.

View File

@@ -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 positionbased 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, caseinsensitive 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 clientside.
/// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter"
#[prost(string, tag = "1")]
pub r#type: ::prost::alloc::string::String,
/// Optional freetext 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 humanreadable 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 {

View File

@@ -20,6 +20,7 @@
rustfmt
clippy
cargo-watch
rust-analyzer
# C build tools (for your linker issue)
gcc