Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: bump validator crate version (#6494)
Richard Shiue6e0619c21ef5
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex 19455d5b62..db6f7b9185 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -1334,7 +1334,7 @@ dependencies = ["cssparser-macros","dtoa-short","itoa",- "phf 0.8.0",+ "phf 0.11.2","smallvec",]@@ -1378,6 +1378,41 @@ dependencies = ["cipher",]+[[package]]+name = "darling"+version = "0.20.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391"+dependencies = [+ "darling_core",+ "darling_macro",+]++[[package]]+name = "darling_core"+version = "0.20.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f"+dependencies = [+ "fnv",+ "ident_case",+ "proc-macro2",+ "quote",+ "strsim 0.10.0",+ "syn 2.0.47",+]++[[package]]+name = "darling_macro"+version = "0.20.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"+dependencies = [+ "darling_core",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "dart-ffi"version = "0.1.0"@@ -1464,7 +1499,7 @@ dependencies = ["thiserror","tracing","uuid",- "validator",+ "validator 0.16.1",][[package]]@@ -1939,7 +1974,7 @@ dependencies = ["tracing","tracing-subscriber","uuid",- "validator",+ "validator 0.18.1","zip","zip-extensions",]@@ -2116,7 +2151,7 @@ dependencies = ["tokio-util","tracing","url",- "validator",+ "validator 0.18.1",][[package]]@@ -2186,7 +2221,7 @@ dependencies = ["tracing","tracing-subscriber","uuid",- "validator",+ "validator 0.18.1",][[package]]@@ -2240,7 +2275,7 @@ dependencies = ["thiserror","tokio","url",- "validator",+ "validator 0.18.1",][[package]]@@ -2279,7 +2314,7 @@ dependencies = ["tracing","unicode-segmentation","uuid",- "validator",+ "validator 0.18.1",][[package]]@@ -2339,13 +2374,13 @@ dependencies = ["protobuf","serde","serde_json",- "strsim",+ "strsim 0.11.0","strum_macros 0.26.1","tantivy","tempfile","tokio","tracing",- "validator",+ "validator 0.18.1",][[package]]@@ -2550,7 +2585,7 @@ dependencies = ["tracing","unicode-segmentation","uuid",- "validator",+ "validator 0.18.1",][[package]]@@ -3152,6 +3187,12 @@ dependencies = ["cc",]+[[package]]+name = "ident_case"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"+[[package]]name = "idna"version = "0.3.0"@@ -3420,7 +3461,7 @@ dependencies = ["thread-id","tokio","tracing",- "validator",+ "validator 0.18.1","wasm-bindgen","wasm-bindgen-futures",]@@ -3446,7 +3487,7 @@ dependencies = ["tempfile","tokio","tracing",- "validator",+ "validator 0.18.1","walkdir","zip",]@@ -4218,7 +4259,7 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"dependencies = [- "phf_macros",+ "phf_macros 0.8.0","phf_shared 0.8.0","proc-macro-hack",]@@ -4238,6 +4279,7 @@ version = "0.11.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"dependencies = [+ "phf_macros 0.11.2","phf_shared 0.11.2",]@@ -4305,6 +4347,19 @@ dependencies = ["syn 1.0.109",]+[[package]]+name = "phf_macros"+version = "0.11.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"+dependencies = [+ "phf_generator 0.11.2",+ "phf_shared 0.11.2",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "phf_shared"version = "0.8.0"@@ -5701,6 +5756,12 @@ dependencies = ["unicode-normalization",]+[[package]]+name = "strsim"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"+[[package]]name = "strsim"version = "0.11.0"@@ -6756,7 +6817,23 @@ dependencies = ["serde_derive","serde_json","url",- "validator_derive",+ "validator_derive 0.16.0",+]++[[package]]+name = "validator"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "db79c75af171630a3148bd3e6d7c4f42b6a9a014c2945bc5ed0020cbb8d9478e"+dependencies = [+ "idna 0.5.0",+ "once_cell",+ "regex",+ "serde",+ "serde_derive",+ "serde_json",+ "url",+ "validator_derive 0.18.2",][[package]]@@ -6775,6 +6852,20 @@ dependencies = ["validator_types",]+[[package]]+name = "validator_derive"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df0bcf92720c40105ac4b2dda2a4ea3aa717d4d6a862cc217da653a4bd5c6b10"+dependencies = [+ "darling",+ "once_cell",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "validator_types"version = "0.16.0"diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex e1d6d3bbbc..b2429ccb38 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -96,7 +96,7 @@ collab-plugins = { version = "0.2" }collab-user = { version = "0.2" }collab-importer = { version = "0.1" }yrs = "0.21.0"-validator = { version = "0.16.1", features = ["derive"] }+validator = { version = "0.18", features = ["derive"] }tokio-util = "0.7.11"zip = "2.2.0"dashmap = "6.0.1"diff --git a/frontend/rust-lib/flowy-ai/src/entities.rs b/frontend/rust-lib/flowy-ai/src/entities.rsindex 007d7c1d06..3dbfe55722 100644--- a/frontend/rust-lib/flowy-ai/src/entities.rs+++ b/frontend/rust-lib/flowy-ai/src/entities.rs@@ -9,10 +9,11 @@ use flowy_ai_pub::cloud::{use flowy_derive::{ProtoBuf, ProtoBuf_Enum};use lib_infra::validator_fn::required_not_empty_str;use validator::Validate;+#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct ChatId {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub value: String,}@@ -36,11 +37,11 @@ pub struct FilePB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct SendChatPayloadPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub message: String,#[pb(index = 3)]@@ -50,11 +51,11 @@ pub struct SendChatPayloadPB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct StreamChatPayloadPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub message: String,#[pb(index = 3)]@@ -100,7 +101,7 @@ pub enum ChatMessageMetaTypePB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct StopStreamPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,}@@ -114,7 +115,7 @@ pub enum ChatMessageTypePB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct LoadPrevChatMessagePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,#[pb(index = 2)]@@ -127,7 +128,7 @@ pub struct LoadPrevChatMessagePB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct LoadNextChatMessagePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,#[pb(index = 2)]@@ -367,11 +368,11 @@ pub enum ModelTypePB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct ChatFilePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub file_path: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,}@@ -510,17 +511,17 @@ pub struct OfflineAIPB {#[derive(Default, ProtoBuf, Validate, Clone, Debug)]pub struct CreateChatContextPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub content_type: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub text: String,#[pb(index = 3)]pub metadata: HashMap<String, String>,#[pb(index = 4)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub chat_id: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/calculation/calculation_changeset.rs b/frontend/rust-lib/flowy-database2/src/entities/calculation/calculation_changeset.rsindex a760c3cee5..c7fbb3368f 100644--- a/frontend/rust-lib/flowy-database2/src/entities/calculation/calculation_changeset.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/calculation/calculation_changeset.rs@@ -8,14 +8,14 @@ use validator::Validate;#[derive(Default, ProtoBuf, Validate)]pub struct UpdateCalculationChangesetPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2, one_of)]pub calculation_id: Option<String>,#[pb(index = 3)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,#[pb(index = 4)]@@ -25,15 +25,15 @@ pub struct UpdateCalculationChangesetPB {#[derive(Default, ProtoBuf, Validate)]pub struct RemoveCalculationChangesetPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,#[pb(index = 3)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub calculation_id: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/database_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/database_entities.rsindex 6be48c856c..8c16db4379 100644--- a/frontend/rust-lib/flowy-database2/src/entities/database_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/database_entities.rs@@ -77,7 +77,7 @@ pub struct RepeatedDatabaseIdPB {#[derive(Clone, ProtoBuf, Default, Debug, Validate)]pub struct DatabaseViewIdPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub value: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rsindex da11523380..8731b63b66 100644--- a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs@@ -380,11 +380,11 @@ impl TryInto<GetFieldParams> for GetFieldPayloadPB {#[derive(Debug, Clone, Default, ProtoBuf, Validate)]pub struct FieldChangesetPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 3, one_of)]@@ -606,11 +606,11 @@ impl TryInto<FieldIdParams> for DuplicateFieldPayloadPB {#[derive(Debug, Clone, Default, ProtoBuf, Validate)]pub struct ClearFieldPayloadPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,#[pb(index = 2)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rsindex 1d59b0b87e..8171ed11a8 100644--- a/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs@@ -101,11 +101,11 @@ impl std::convert::From<Vec<FieldSettingsPB>> for RepeatedFieldSettingsPB {#[derive(Debug, Default, Clone, ProtoBuf, Validate)]pub struct FieldSettingsChangesetPB {- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]#[pb(index = 1)]pub view_id: String,- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]#[pb(index = 2)]pub field_id: String,diff --git a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rsindex a8649a03e7..64331c9542 100644--- a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs@@ -213,7 +213,7 @@ impl From<Vec<FilterPB>> for RepeatedFilterPB {pub struct InsertFilterPB {/// If None, the filter will be the root of a new filter tree#[pb(index = 1, one_of)]- #[validate(custom = "crate::entities::utils::validate_filter_id")]+ #[validate(custom(function = "crate::entities::utils::validate_filter_id"))]pub parent_filter_id: Option<String>,#[pb(index = 2)]@@ -223,7 +223,7 @@ pub struct InsertFilterPB {#[derive(ProtoBuf, Debug, Default, Clone, Validate)]pub struct UpdateFilterTypePB {#[pb(index = 1)]- #[validate(custom = "crate::entities::utils::validate_filter_id")]+ #[validate(custom(function = "crate::entities::utils::validate_filter_id"))]pub filter_id: String,#[pb(index = 2)]@@ -233,7 +233,7 @@ pub struct UpdateFilterTypePB {#[derive(ProtoBuf, Debug, Default, Clone, Validate)]pub struct UpdateFilterDataPB {#[pb(index = 1)]- #[validate(custom = "crate::entities::utils::validate_filter_id")]+ #[validate(custom(function = "crate::entities::utils::validate_filter_id"))]pub filter_id: String,#[pb(index = 2)]@@ -243,7 +243,7 @@ pub struct UpdateFilterDataPB {#[derive(ProtoBuf, Debug, Default, Clone, Validate)]pub struct DeleteFilterPB {#[pb(index = 1)]- #[validate(custom = "crate::entities::utils::validate_filter_id")]+ #[validate(custom(function = "crate::entities::utils::validate_filter_id"))]pub filter_id: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/group_entities/group.rs b/frontend/rust-lib/flowy-database2/src/entities/group_entities/group.rsindex 5139fae482..eef2b740c4 100644--- a/frontend/rust-lib/flowy-database2/src/entities/group_entities/group.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/group_entities/group.rs@@ -2,6 +2,7 @@ use std::convert::TryInto;use flowy_derive::ProtoBuf;use flowy_error::ErrorCode;+use lib_infra::validator_fn::required_not_empty_str;use validator::Validate;use crate::entities::parser::NotEmptyStr;@@ -145,11 +146,11 @@ pub struct GroupByFieldParams {#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone, Validate)]pub struct UpdateGroupPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub group_id: String,#[pb(index = 3, one_of)]diff --git a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rsindex 85ddc1596f..936d41a64c 100644--- a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs@@ -460,14 +460,14 @@ pub struct RepeatedRowIdPB {#[derive(ProtoBuf, Default, Validate)]pub struct CreateRowPayloadPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]pub row_position: OrderObjectPositionPB,#[pb(index = 3, one_of)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub group_id: Option<String>,#[pb(index = 4)]@@ -494,14 +494,14 @@ pub struct SummaryRowPB {#[derive(Debug, Default, Clone, ProtoBuf, Validate)]pub struct TranslateRowPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub row_id: String,#[pb(index = 3)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/setting_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/setting_entities.rsindex 2cb2f3613d..4b8f0eebe9 100644--- a/frontend/rust-lib/flowy-database2/src/entities/setting_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/setting_entities.rs@@ -71,42 +71,42 @@ impl std::convert::From<DatabaseLayoutPB> for DatabaseLayout {#[derive(Default, Validate, ProtoBuf)]pub struct DatabaseSettingChangesetPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "lib_infra::validator_fn::required_not_empty_str"))]pub view_id: String,#[pb(index = 2, one_of)]pub layout_type: Option<DatabaseLayoutPB>,#[pb(index = 3, one_of)]- #[validate]+ #[validate(nested)]pub insert_filter: Option<InsertFilterPB>,#[pb(index = 4, one_of)]- #[validate]+ #[validate(nested)]pub update_filter_type: Option<UpdateFilterTypePB>,#[pb(index = 5, one_of)]- #[validate]+ #[validate(nested)]pub update_filter_data: Option<UpdateFilterDataPB>,#[pb(index = 6, one_of)]- #[validate]+ #[validate(nested)]pub delete_filter: Option<DeleteFilterPB>,#[pb(index = 7, one_of)]- #[validate]+ #[validate(nested)]pub update_group: Option<UpdateGroupPB>,#[pb(index = 8, one_of)]- #[validate]+ #[validate(nested)]pub update_sort: Option<UpdateSortPayloadPB>,#[pb(index = 9, one_of)]- #[validate]+ #[validate(nested)]pub reorder_sort: Option<ReorderSortPayloadPB>,#[pb(index = 10, one_of)]- #[validate]+ #[validate(nested)]pub delete_sort: Option<DeleteSortPayloadPB>,}diff --git a/frontend/rust-lib/flowy-database2/src/entities/sort_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/sort_entities.rsindex 307b261d0f..59dc683087 100644--- a/frontend/rust-lib/flowy-database2/src/entities/sort_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/sort_entities.rs@@ -1,4 +1,5 @@use flowy_derive::{ProtoBuf, ProtoBuf_Enum};+use lib_infra::validator_fn::required_not_empty_str;use validator::Validate;use crate::services::sort::{Sort, SortCondition};@@ -96,16 +97,16 @@ impl std::convert::From<SortConditionPB> for SortCondition {#[derive(ProtoBuf, Debug, Default, Clone, Validate)]pub struct UpdateSortPayloadPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub field_id: String,/// Create a new sort if the sort_id is None#[pb(index = 3, one_of)]- #[validate(custom = "super::utils::validate_sort_id")]+ #[validate(custom(function = "super::utils::validate_sort_id"))]pub sort_id: Option<String>,#[pb(index = 4)]@@ -115,26 +116,26 @@ pub struct UpdateSortPayloadPB {#[derive(Debug, Default, Clone, Validate, ProtoBuf)]pub struct ReorderSortPayloadPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "super::utils::validate_sort_id")]+ #[validate(custom(function = "super::utils::validate_sort_id"))]pub from_sort_id: String,#[pb(index = 3)]- #[validate(custom = "super::utils::validate_sort_id")]+ #[validate(custom(function = "super::utils::validate_sort_id"))]pub to_sort_id: String,}#[derive(ProtoBuf, Debug, Default, Clone, Validate)]pub struct DeleteSortPayloadPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub view_id: String,#[pb(index = 2)]- #[validate(custom = "super::utils::validate_sort_id")]+ #[validate(custom(function = "super::utils::validate_sort_id"))]pub sort_id: String,}diff --git a/frontend/rust-lib/flowy-document/Cargo.toml b/frontend/rust-lib/flowy-document/Cargo.tomlindex 6fe59c0c52..e981fb9acb 100644--- a/frontend/rust-lib/flowy-document/Cargo.toml+++ b/frontend/rust-lib/flowy-document/Cargo.toml@@ -20,7 +20,7 @@ flowy-notification = { workspace = true }flowy-error = { path = "../flowy-error", features = ["impl_from_serde", "impl_from_dispatch_error", "impl_from_collab_document", "impl_from_collab_persistence"] }lib-dispatch = { workspace = true }lib-infra = { workspace = true }-validator = { version = "0.16.0", features = ["derive"] }+validator = { workspace = true, features = ["derive"] }protobuf.workspace = truebytes.workspace = truenanoid = "0.4.0"diff --git a/frontend/rust-lib/flowy-document/src/entities.rs b/frontend/rust-lib/flowy-document/src/entities.rsindex f408dbabca..24611a8140 100644--- a/frontend/rust-lib/flowy-document/src/entities.rs+++ b/frontend/rust-lib/flowy-document/src/entities.rs@@ -81,15 +81,15 @@ pub struct DocumentRedoUndoResponsePB {#[derive(Default, ProtoBuf, Validate)]pub struct UploadFileParamsPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub document_id: String,#[pb(index = 3)]- #[validate(custom = "required_valid_path")]+ #[validate(custom(function = "required_valid_path"))]pub local_file_path: String,}@@ -100,7 +100,7 @@ pub struct UploadedFilePB {pub url: String,#[pb(index = 2)]- #[validate(custom = "required_valid_path")]+ #[validate(custom(function = "required_valid_path"))]pub local_file_path: String,}@@ -111,7 +111,7 @@ pub struct DownloadFilePB {pub url: String,#[pb(index = 2)]- #[validate(custom = "required_valid_path")]+ #[validate(custom(function = "required_valid_path"))]pub local_file_path: String,}diff --git a/frontend/rust-lib/flowy-document/src/parser/parser_entities.rs b/frontend/rust-lib/flowy-document/src/parser/parser_entities.rsindex cb7bf35e27..8acdecae36 100644--- a/frontend/rust-lib/flowy-document/src/parser/parser_entities.rs+++ b/frontend/rust-lib/flowy-document/src/parser/parser_entities.rs@@ -508,7 +508,7 @@ pub enum InputType {#[derive(Default, ProtoBuf, Debug, Validate)]pub struct ConvertDataToJsonPayloadPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub data: String,#[pb(index = 2)]diff --git a/frontend/rust-lib/flowy-folder/src/entities/import.rs b/frontend/rust-lib/flowy-folder/src/entities/import.rsindex 8029b88bb2..af34938361 100644--- a/frontend/rust-lib/flowy-folder/src/entities/import.rs+++ b/frontend/rust-lib/flowy-folder/src/entities/import.rs@@ -71,7 +71,7 @@ pub struct ImportValuePayloadPB {#[derive(Clone, Debug, Validate, ProtoBuf, Default)]pub struct ImportPayloadPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub parent_view_id: String,#[pb(index = 2)]@@ -81,11 +81,11 @@ pub struct ImportPayloadPB {#[derive(Clone, Debug, Validate, ProtoBuf, Default)]pub struct ImportZipPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub parent_view_id: String,#[pb(index = 2)]- #[validate(custom = "required_valid_path")]+ #[validate(custom(function = "required_valid_path"))]pub file_path: String,}diff --git a/frontend/rust-lib/flowy-search/Cargo.toml b/frontend/rust-lib/flowy-search/Cargo.tomlindex a98ab15a38..2769f55479 100644--- a/frontend/rust-lib/flowy-search/Cargo.toml+++ b/frontend/rust-lib/flowy-search/Cargo.toml@@ -38,7 +38,7 @@ strsim = "0.11.0"strum_macros = "0.26.1"tantivy = { version = "0.22.0" }tempfile = "3.9.0"-validator = { version = "0.16.0", features = ["derive"] }+validator = { workspace = true, features = ["derive"] }diesel.workspace = truediesel_derives = { version = "2.1.0", features = ["sqlite", "r2d2"] }diff --git a/frontend/rust-lib/flowy-user/src/entities/import_data.rs b/frontend/rust-lib/flowy-user/src/entities/import_data.rsindex a472b5d588..687b65835e 100644--- a/frontend/rust-lib/flowy-user/src/entities/import_data.rs+++ b/frontend/rust-lib/flowy-user/src/entities/import_data.rs@@ -1,10 +1,11 @@use flowy_derive::ProtoBuf;+use lib_infra::validator_fn::required_not_empty_str;use validator::Validate;#[derive(ProtoBuf, Validate, Default)]pub struct ImportAppFlowyDataPB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub path: String,#[pb(index = 2, one_of)]diff --git a/frontend/rust-lib/flowy-user/src/entities/parser/user_email.rs b/frontend/rust-lib/flowy-user/src/entities/parser/user_email.rsindex a3ec143317..f9a1979c53 100644--- a/frontend/rust-lib/flowy-user/src/entities/parser/user_email.rs+++ b/frontend/rust-lib/flowy-user/src/entities/parser/user_email.rs@@ -1,5 +1,5 @@use flowy_error::ErrorCode;-use validator::validate_email;+use validator::ValidateEmail;#[derive(Debug)]pub struct UserEmail(pub String);@@ -10,7 +10,7 @@ impl UserEmail {return Err(ErrorCode::EmailIsEmpty);}- if validate_email(&s) {+ if ValidateEmail::validate_email(&s) {Ok(Self(s))} else {Err(ErrorCode::EmailFormatInvalid)diff --git a/frontend/rust-lib/flowy-user/src/entities/user_profile.rs b/frontend/rust-lib/flowy-user/src/entities/user_profile.rsindex ffb22b976f..ec2dd70291 100644--- a/frontend/rust-lib/flowy-user/src/entities/user_profile.rs+++ b/frontend/rust-lib/flowy-user/src/entities/user_profile.rs@@ -1,9 +1,10 @@use std::convert::TryInto;use std::str::FromStr;-use validator::Validate;use flowy_derive::{ProtoBuf, ProtoBuf_Enum};use flowy_user_pub::entities::*;+use lib_infra::validator_fn::required_not_empty_str;+use validator::Validate;use crate::entities::parser::{UserEmail, UserIcon, UserName, UserOpenaiKey, UserPassword};use crate::entities::{AIModelPB, AuthenticatorPB};@@ -222,7 +223,7 @@ impl From<Vec<UserWorkspace>> for RepeatedUserWorkspacePB {#[derive(ProtoBuf, Default, Debug, Clone, Validate)]pub struct UserWorkspacePB {#[pb(index = 1)]- #[validate(custom = "lib_infra::validator_fn::required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]diff --git a/frontend/rust-lib/flowy-user/src/entities/workspace.rs b/frontend/rust-lib/flowy-user/src/entities/workspace.rsindex dd81c7ed0c..211f75ef4c 100644--- a/frontend/rust-lib/flowy-user/src/entities/workspace.rs+++ b/frontend/rust-lib/flowy-user/src/entities/workspace.rs@@ -46,7 +46,7 @@ pub struct RepeatedWorkspaceMemberPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct WorkspaceMemberInvitationPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -98,7 +98,7 @@ impl From<WorkspaceInvitation> for WorkspaceInvitationPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct AcceptWorkspaceInvitationPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub invite_id: String,}@@ -106,7 +106,7 @@ pub struct AcceptWorkspaceInvitationPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct AddWorkspaceMemberPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -117,14 +117,14 @@ pub struct AddWorkspaceMemberPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct QueryWorkspacePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,}#[derive(ProtoBuf, Default, Clone, Validate)]pub struct RemoveWorkspaceMemberPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -135,7 +135,7 @@ pub struct RemoveWorkspaceMemberPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct UpdateWorkspaceMemberPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -178,14 +178,14 @@ impl From<Role> for AFRolePB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct UserWorkspaceIdPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,}#[derive(ProtoBuf, Default, Clone, Validate)]pub struct CancelWorkspaceSubscriptionPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -198,7 +198,7 @@ pub struct CancelWorkspaceSubscriptionPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct SuccessWorkspaceSubscriptionPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2, one_of)]@@ -214,25 +214,25 @@ pub struct WorkspaceMemberIdPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct CreateWorkspacePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub name: String,}#[derive(ProtoBuf, Default, Clone, Validate)]pub struct RenameWorkspacePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub new_name: String,}#[derive(ProtoBuf, Default, Clone, Validate)]pub struct ChangeWorkspaceIconPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -242,7 +242,7 @@ pub struct ChangeWorkspaceIconPB {#[derive(ProtoBuf, Default, Clone, Validate, Debug)]pub struct SubscribeWorkspacePB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]@@ -397,7 +397,7 @@ impl From<AFWorkspaceSettings> for UseAISettingPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct UpdateUserWorkspaceSettingPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2, one_of)]@@ -643,7 +643,7 @@ impl From<i64> for WorkspaceSubscriptionStatusPB {#[derive(ProtoBuf, Default, Clone, Validate)]pub struct UpdateWorkspaceSubscriptionPaymentPeriodPB {#[pb(index = 1)]- #[validate(custom = "required_not_empty_str")]+ #[validate(custom(function = "required_not_empty_str"))]pub workspace_id: String,#[pb(index = 2)]diff --git a/frontend/rust-lib/lib-dispatch/Cargo.toml b/frontend/rust-lib/lib-dispatch/Cargo.tomlindex a9636c3c8d..1630d3bc47 100644--- a/frontend/rust-lib/lib-dispatch/Cargo.toml+++ b/frontend/rust-lib/lib-dispatch/Cargo.toml@@ -21,7 +21,7 @@ derivative = "2.2.0"serde_json = { workspace = true, optional = true }serde = { version = "1.0", features = ["derive"], optional = true }serde_repr = { workspace = true, optional = true }-validator = "0.16.1"+validator = { workspace = true, features = ["derive"] }tracing.workspace = truebincode = { version = "1.3", optional = true }protobuf = { workspace = true, optional = true }@@ -45,5 +45,3 @@ default = ["local_set", "use_protobuf"]use_serde = ["bincode", "serde_json", "serde", "serde_repr"]use_protobuf = ["protobuf"]local_set = []--diff --git a/frontend/rust-lib/lib-dispatch/src/data.rs b/frontend/rust-lib/lib-dispatch/src/data.rsindex 5d73bf87df..e3989adfce 100644--- a/frontend/rust-lib/lib-dispatch/src/data.rs+++ b/frontend/rust-lib/lib-dispatch/src/data.rs@@ -2,7 +2,7 @@ use std::fmt::{Debug, Formatter};use std::ops;use bytes::Bytes;-use validator::ValidationErrors;+use validator::{Validate, ValidationErrors};use crate::{byte_trait::*,@@ -28,7 +28,7 @@ impl<T> AFPluginData<T> {impl<T> AFPluginData<T>where- T: validator::Validate,+ T: Validate,{pub fn try_into_inner(self) -> Result<T, ValidationErrors> {self.0.validate()?;diff --git a/frontend/rust-lib/lib-infra/Cargo.toml b/frontend/rust-lib/lib-infra/Cargo.tomlindex 62f872a553..7dc6f85bb3 100644--- a/frontend/rust-lib/lib-infra/Cargo.toml+++ b/frontend/rust-lib/lib-infra/Cargo.toml@@ -18,7 +18,7 @@ md5 = "0.7.0"anyhow.workspace = truewalkdir = "2.4.0"tempfile = "3.8.1"-validator = { version = "0.16.1", features = ["derive"] }+validator = { workspace = true, features = ["derive"] }tracing.workspace = trueatomic_refcell = "0.1"allo-isolate = { version = "^0.1", features = ["catch-unwind"], optional = true }