mask optionally part of the data
This commit is contained in:
2
client
2
client
Submodule client updated: 827e6a408a...949b8c784d
@@ -13,7 +13,7 @@ package komp_ac.table_validation;
|
||||
//
|
||||
// Important split:
|
||||
// - limits / pattern / allowed_values / required are validation rules.
|
||||
// - mask is presentation and input-shaping metadata for clients.
|
||||
// - mask is presentation/input-shaping metadata plus an optional storage policy.
|
||||
|
||||
// Request validation rules for a table
|
||||
message GetTableValidationRequest {
|
||||
@@ -44,7 +44,7 @@ message FieldValidation {
|
||||
// Client-side hint that this field participates in external/asynchronous validation UI.
|
||||
bool external_validation_enabled = 13;
|
||||
|
||||
// Client-side display mask metadata. The server stores raw data without mask literals.
|
||||
// Client-side display mask metadata and persisted representation policy.
|
||||
DisplayMask mask = 3;
|
||||
|
||||
// Field must be provided / treated as required by clients and server enforcement layers.
|
||||
@@ -76,14 +76,18 @@ message CharacterLimits {
|
||||
CountMode countMode = 4; // defaults to CHARS if unspecified
|
||||
}
|
||||
|
||||
// Mask for pretty display only.
|
||||
//
|
||||
// This is not a validation rule by itself. It exists so clients can render and
|
||||
// navigate masked input while still storing raw values server-side.
|
||||
enum MaskStorageMode {
|
||||
MASK_STORAGE_MODE_RAW = 0;
|
||||
MASK_STORAGE_MODE_FORMATTED = 1;
|
||||
}
|
||||
|
||||
// Mask metadata used for rendering, input navigation, and optional persistence
|
||||
// of reached mask literals. Template placeholders are never persisted.
|
||||
message DisplayMask {
|
||||
string pattern = 1; // e.g., "(###) ###-####" or "####-##-##"
|
||||
string input_char = 2; // e.g., "#"
|
||||
optional string template_char = 3; // e.g., "_"
|
||||
optional MaskStorageMode storage_mode = 4; // absent/default means raw
|
||||
}
|
||||
|
||||
// Which positions a pattern rule applies to.
|
||||
|
||||
Binary file not shown.
@@ -34,7 +34,7 @@ pub struct FieldValidation {
|
||||
/// Client-side hint that this field participates in external/asynchronous validation UI.
|
||||
#[prost(bool, tag = "13")]
|
||||
pub external_validation_enabled: bool,
|
||||
/// Client-side display mask metadata. The server stores raw data without mask literals.
|
||||
/// Client-side display mask metadata and persisted representation policy.
|
||||
#[prost(message, optional, tag = "3")]
|
||||
pub mask: ::core::option::Option<DisplayMask>,
|
||||
/// Field must be provided / treated as required by clients and server enforcement layers.
|
||||
@@ -63,10 +63,8 @@ pub struct CharacterLimits {
|
||||
#[prost(enumeration = "CountMode", tag = "4")]
|
||||
pub count_mode: i32,
|
||||
}
|
||||
/// Mask for pretty display only.
|
||||
///
|
||||
/// This is not a validation rule by itself. It exists so clients can render and
|
||||
/// navigate masked input while still storing raw values server-side.
|
||||
/// Mask metadata used for rendering, input navigation, and optional persistence
|
||||
/// of reached mask literals. Template placeholders are never persisted.
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct DisplayMask {
|
||||
@@ -79,6 +77,9 @@ pub struct DisplayMask {
|
||||
/// e.g., "\_"
|
||||
#[prost(string, optional, tag = "3")]
|
||||
pub template_char: ::core::option::Option<::prost::alloc::string::String>,
|
||||
/// absent/default means raw
|
||||
#[prost(enumeration = "MaskStorageMode", optional, tag = "4")]
|
||||
pub storage_mode: ::core::option::Option<i32>,
|
||||
}
|
||||
/// Which positions a pattern rule applies to.
|
||||
/// This exists instead of a string syntax like "0-3" so the server can validate
|
||||
@@ -401,6 +402,32 @@ impl CountMode {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
#[repr(i32)]
|
||||
pub enum MaskStorageMode {
|
||||
Raw = 0,
|
||||
Formatted = 1,
|
||||
}
|
||||
impl MaskStorageMode {
|
||||
/// String value of the enum field names used in the ProtoBuf definition.
|
||||
///
|
||||
/// The values are not transformed in any way and thus are considered stable
|
||||
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
||||
pub fn as_str_name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Raw => "MASK_STORAGE_MODE_RAW",
|
||||
Self::Formatted => "MASK_STORAGE_MODE_FORMATTED",
|
||||
}
|
||||
}
|
||||
/// Creates an enum from field names used in the ProtoBuf definition.
|
||||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
||||
match value {
|
||||
"MASK_STORAGE_MODE_RAW" => Some(Self::Raw),
|
||||
"MASK_STORAGE_MODE_FORMATTED" => Some(Self::Formatted),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||
|
||||
2
server
2
server
Submodule server updated: e8c579bf55...65e67fe785
Submodule tui-canvas updated: dbec3130b3...f9d2a7a312
Submodule tui-pages updated: 8c66dedc33...50e1145a9a
@@ -163,6 +163,7 @@ impl ValidationForm {
|
||||
self.mask_input_char.clone()
|
||||
},
|
||||
template_char: nonempty(&self.mask_template_char),
|
||||
storage_mode: None,
|
||||
});
|
||||
let pattern = parse_pattern_rules(&self.pattern_rules, &self.pattern_description)?;
|
||||
Ok(FieldValidation {
|
||||
|
||||
Reference in New Issue
Block a user