removed formatter for rules
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -493,7 +493,7 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "canvas"
|
name = "canvas"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -586,7 +586,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "client"
|
name = "client"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -642,7 +642,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"prost 0.13.5",
|
"prost 0.13.5",
|
||||||
"prost-build 0.14.1",
|
"prost-build 0.14.1",
|
||||||
@@ -3117,7 +3117,7 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "search"
|
name = "search"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"common",
|
"common",
|
||||||
@@ -3216,7 +3216,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server"
|
name = "server"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
@@ -4549,7 +4549,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "validation-core"
|
name = "validation-core"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
2
client
2
client
Submodule client updated: 426f85d6cf...768592e673
@@ -40,14 +40,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
".komp_ac.table_validation.PatternRules",
|
".komp_ac.table_validation.PatternRules",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||||
)
|
)
|
||||||
.type_attribute(
|
|
||||||
".komp_ac.table_validation.CustomFormatter",
|
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
|
||||||
)
|
|
||||||
.type_attribute(
|
|
||||||
".komp_ac.table_validation.FormatterOption",
|
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
|
||||||
)
|
|
||||||
.type_attribute(
|
.type_attribute(
|
||||||
".komp_ac.table_validation.AllowedValues",
|
".komp_ac.table_validation.AllowedValues",
|
||||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ package komp_ac.table_validation;
|
|||||||
//
|
//
|
||||||
// Important split:
|
// Important split:
|
||||||
// - limits / pattern / allowed_values / required are validation rules.
|
// - limits / pattern / allowed_values / required are validation rules.
|
||||||
// - mask / formatter are presentation and input-shaping metadata for clients.
|
// - mask is presentation and input-shaping metadata for clients.
|
||||||
|
|
||||||
// Request validation rules for a table
|
// Request validation rules for a table
|
||||||
message GetTableValidationRequest {
|
message GetTableValidationRequest {
|
||||||
@@ -44,9 +44,6 @@ message FieldValidation {
|
|||||||
// Client-side hint that this field participates in external/asynchronous validation UI.
|
// Client-side hint that this field participates in external/asynchronous validation UI.
|
||||||
bool external_validation_enabled = 13;
|
bool external_validation_enabled = 13;
|
||||||
|
|
||||||
// Client-side formatter metadata. This is intentionally data-only, not executable code.
|
|
||||||
optional CustomFormatter formatter = 14;
|
|
||||||
|
|
||||||
// Client-side display mask metadata. The server stores raw data without mask literals.
|
// Client-side display mask metadata. The server stores raw data without mask literals.
|
||||||
DisplayMask mask = 3;
|
DisplayMask mask = 3;
|
||||||
|
|
||||||
@@ -139,22 +136,6 @@ message PatternRule {
|
|||||||
CharacterConstraint constraint = 2;
|
CharacterConstraint constraint = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client-side formatter metadata.
|
|
||||||
// The formatter "type" is intended to be resolved by a client-side formatter registry.
|
|
||||||
message CustomFormatter {
|
|
||||||
// Formatter type identifier; handled client‑side.
|
|
||||||
// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter"
|
|
||||||
string type = 1;
|
|
||||||
|
|
||||||
repeated FormatterOption options = 2;
|
|
||||||
optional string description = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message FormatterOption {
|
|
||||||
string key = 1;
|
|
||||||
string value = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exact-value whitelist configuration.
|
// Exact-value whitelist configuration.
|
||||||
// This maps to canvas AllowedValues semantics.
|
// This maps to canvas AllowedValues semantics.
|
||||||
message AllowedValues {
|
message AllowedValues {
|
||||||
|
|||||||
Binary file not shown.
@@ -34,9 +34,6 @@ pub struct FieldValidation {
|
|||||||
/// Client-side hint that this field participates in external/asynchronous validation UI.
|
/// Client-side hint that this field participates in external/asynchronous validation UI.
|
||||||
#[prost(bool, tag = "13")]
|
#[prost(bool, tag = "13")]
|
||||||
pub external_validation_enabled: bool,
|
pub external_validation_enabled: bool,
|
||||||
/// Client-side formatter metadata. This is intentionally data-only, not executable code.
|
|
||||||
#[prost(message, optional, tag = "14")]
|
|
||||||
pub formatter: ::core::option::Option<CustomFormatter>,
|
|
||||||
/// Client-side display mask metadata. The server stores raw data without mask literals.
|
/// Client-side display mask metadata. The server stores raw data without mask literals.
|
||||||
#[prost(message, optional, tag = "3")]
|
#[prost(message, optional, tag = "3")]
|
||||||
pub mask: ::core::option::Option<DisplayMask>,
|
pub mask: ::core::option::Option<DisplayMask>,
|
||||||
@@ -126,28 +123,6 @@ pub struct PatternRule {
|
|||||||
#[prost(message, optional, tag = "2")]
|
#[prost(message, optional, tag = "2")]
|
||||||
pub constraint: ::core::option::Option<CharacterConstraint>,
|
pub constraint: ::core::option::Option<CharacterConstraint>,
|
||||||
}
|
}
|
||||||
/// Client-side formatter metadata.
|
|
||||||
/// The formatter "type" is intended to be resolved by a client-side formatter registry.
|
|
||||||
#[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,
|
|
||||||
#[prost(message, repeated, tag = "2")]
|
|
||||||
pub options: ::prost::alloc::vec::Vec<FormatterOption>,
|
|
||||||
#[prost(string, optional, tag = "3")]
|
|
||||||
pub description: ::core::option::Option<::prost::alloc::string::String>,
|
|
||||||
}
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
||||||
pub struct FormatterOption {
|
|
||||||
#[prost(string, tag = "1")]
|
|
||||||
pub key: ::prost::alloc::string::String,
|
|
||||||
#[prost(string, tag = "2")]
|
|
||||||
pub value: ::prost::alloc::string::String,
|
|
||||||
}
|
|
||||||
/// Exact-value whitelist configuration.
|
/// Exact-value whitelist configuration.
|
||||||
/// This maps to canvas AllowedValues semantics.
|
/// This maps to canvas AllowedValues semantics.
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: aa0f9a3108...24339bf7af
Submodule tui-pages updated: 981d0763bd...aa05de8dc8
@@ -282,17 +282,6 @@ mask:
|
|||||||
Canvas uses this for display/editing. Backend expects raw values without mask
|
Canvas uses this for display/editing. Backend expects raw values without mask
|
||||||
literals.
|
literals.
|
||||||
|
|
||||||
### Formatter
|
|
||||||
|
|
||||||
```text
|
|
||||||
formatter:
|
|
||||||
type: "PhoneFormatter"
|
|
||||||
options: []
|
|
||||||
description: optional
|
|
||||||
```
|
|
||||||
|
|
||||||
Formatter is resolved client-side. Backend stores it but does not execute it.
|
|
||||||
|
|
||||||
### External Validation
|
### External Validation
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@@ -331,7 +320,6 @@ limits section
|
|||||||
pattern section
|
pattern section
|
||||||
allowed values section
|
allowed values section
|
||||||
mask section
|
mask section
|
||||||
formatter section
|
|
||||||
external validation toggle
|
external validation toggle
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,6 @@ impl AllowedValues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct FormatterSettings {
|
|
||||||
pub formatter_type: String,
|
|
||||||
pub options: Vec<FormatterOption>,
|
|
||||||
pub description: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct FormatterOption {
|
|
||||||
pub key: String,
|
|
||||||
pub value: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum CharacterFilterSettings {
|
pub enum CharacterFilterSettings {
|
||||||
Alphabetic,
|
Alphabetic,
|
||||||
@@ -129,7 +116,6 @@ pub struct ValidationSettings {
|
|||||||
pub pattern: Option<PatternSettings>,
|
pub pattern: Option<PatternSettings>,
|
||||||
pub allowed_values: Option<AllowedValues>,
|
pub allowed_values: Option<AllowedValues>,
|
||||||
pub display_mask: Option<DisplayMask>,
|
pub display_mask: Option<DisplayMask>,
|
||||||
pub formatter: Option<FormatterSettings>,
|
|
||||||
pub external_validation_enabled: bool,
|
pub external_validation_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +127,6 @@ impl ValidationSettings {
|
|||||||
pattern_filters: self.pattern.as_ref().map(PatternSettings::resolve),
|
pattern_filters: self.pattern.as_ref().map(PatternSettings::resolve),
|
||||||
allowed_values: self.allowed_values.clone(),
|
allowed_values: self.allowed_values.clone(),
|
||||||
display_mask: self.display_mask.clone(),
|
display_mask: self.display_mask.clone(),
|
||||||
formatter: self.formatter.clone(),
|
|
||||||
external_validation_enabled: self.external_validation_enabled,
|
external_validation_enabled: self.external_validation_enabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,7 +158,6 @@ impl ValidationSettings {
|
|||||||
&rule.allowed_values,
|
&rule.allowed_values,
|
||||||
)?;
|
)?;
|
||||||
merge_singleton("display_mask", &mut self.display_mask, &rule.display_mask)?;
|
merge_singleton("display_mask", &mut self.display_mask, &rule.display_mask)?;
|
||||||
merge_singleton("formatter", &mut self.formatter, &rule.formatter)?;
|
|
||||||
|
|
||||||
if let Some(pattern) = &rule.pattern {
|
if let Some(pattern) = &rule.pattern {
|
||||||
match &mut self.pattern {
|
match &mut self.pattern {
|
||||||
@@ -220,7 +204,6 @@ pub struct ValidationConfig {
|
|||||||
pub pattern_filters: Option<PatternFilters>,
|
pub pattern_filters: Option<PatternFilters>,
|
||||||
pub allowed_values: Option<AllowedValues>,
|
pub allowed_values: Option<AllowedValues>,
|
||||||
pub display_mask: Option<DisplayMask>,
|
pub display_mask: Option<DisplayMask>,
|
||||||
pub formatter: Option<FormatterSettings>,
|
|
||||||
pub external_validation_enabled: bool,
|
pub external_validation_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +252,6 @@ impl ValidationConfig {
|
|||||||
|| self.pattern_filters.is_some()
|
|| self.pattern_filters.is_some()
|
||||||
|| self.allowed_values.is_some()
|
|| self.allowed_values.is_some()
|
||||||
|| self.display_mask.is_some()
|
|| self.display_mask.is_some()
|
||||||
|| self.formatter.is_some()
|
|
||||||
|| self.external_validation_enabled
|
|| self.external_validation_enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ pub mod rules;
|
|||||||
pub mod set;
|
pub mod set;
|
||||||
|
|
||||||
pub use config::{
|
pub use config::{
|
||||||
AllowedValues, CharacterFilterSettings, FormatterOption, FormatterSettings, PatternSettings,
|
AllowedValues, CharacterFilterSettings, PatternSettings, PositionFilterSettings,
|
||||||
PositionFilterSettings, ValidationConfig, ValidationMergeError, ValidationResult,
|
ValidationConfig, ValidationMergeError, ValidationResult, ValidationSettings,
|
||||||
ValidationSettings,
|
|
||||||
};
|
};
|
||||||
pub use rules::{
|
pub use rules::{
|
||||||
count_text, CharacterFilter, CharacterLimits, CountMode, DisplayMask, LimitCheckResult,
|
count_text, CharacterFilter, CharacterLimits, CountMode, DisplayMask, LimitCheckResult,
|
||||||
|
|||||||
Reference in New Issue
Block a user