-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3884fb5
commit bb983b6
Showing
13 changed files
with
351 additions
and
271 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27
serde_valid_derive/src/attribute/struct_validate/meta/meta_list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_list, | ||
MetaListStructValidation, Validator, | ||
use syn::spanned::Spanned; | ||
|
||
use crate::{ | ||
attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_list, | ||
MetaListStructValidation, Validator, | ||
}, | ||
warning::{Warning, WithWarnings}, | ||
}; | ||
|
||
pub fn extract_struct_validator_from_meta_list( | ||
validation_type: MetaListStructValidation, | ||
validation: &syn::MetaList, | ||
message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type { | ||
MetaListStructValidation::Custom => { | ||
extract_generic_struct_custom_validator_from_meta_list(validation, message_format) | ||
extract_generic_struct_custom_validator_from_meta_list(validation, message_format).map( | ||
|validator| { | ||
WithWarnings::new_with_warnings( | ||
validator, | ||
vec![Warning::new_custom_meta_list_deprecated( | ||
validation.path.get_ident().unwrap(), | ||
validation.span(), | ||
)], | ||
) | ||
}, | ||
) | ||
} | ||
} | ||
} |
14 changes: 9 additions & 5 deletions
14
serde_valid_derive/src/attribute/struct_validate/meta/meta_name_value.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_name_value, | ||
MetaNameValueStructValidation, Validator, | ||
use crate::{ | ||
attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_name_value, | ||
MetaNameValueStructValidation, Validator, | ||
}, | ||
warning::WithWarnings, | ||
}; | ||
|
||
#[inline] | ||
pub fn extract_struct_validator_from_meta_name_value( | ||
validation_type: MetaNameValueStructValidation, | ||
validation: &syn::MetaNameValue, | ||
message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type { | ||
MetaNameValueStructValidation::Custom => { | ||
extract_generic_struct_custom_validator_from_meta_name_value(validation, message_format) | ||
} | ||
} | ||
.map(WithWarnings::new) | ||
} |
7 changes: 4 additions & 3 deletions
7
serde_valid_derive/src/attribute/struct_validate/meta/meta_path.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, MetaPathStructValidation, Validator, | ||
use crate::{ | ||
attribute::{common::message_format::MessageFormat, MetaPathStructValidation, Validator}, | ||
warning::WithWarnings, | ||
}; | ||
|
||
#[inline] | ||
pub fn extract_struct_validator_from_meta_path( | ||
validation_type: MetaPathStructValidation, | ||
_validation: &syn::Path, | ||
_message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27
serde_valid_derive/src/attribute/variant_validate/meta/meta_list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_list, | ||
MetaListStructValidation, Validator, | ||
use syn::spanned::Spanned; | ||
|
||
use crate::{ | ||
attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_list, | ||
MetaListStructValidation, Validator, | ||
}, | ||
warning::{Warning, WithWarnings}, | ||
}; | ||
|
||
pub fn extract_variant_validator_from_meta_list( | ||
validation_type: MetaListStructValidation, | ||
validation: &syn::MetaList, | ||
message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type { | ||
MetaListStructValidation::Custom => { | ||
extract_generic_struct_custom_validator_from_meta_list(validation, message_format) | ||
extract_generic_struct_custom_validator_from_meta_list(validation, message_format).map( | ||
|validator| { | ||
WithWarnings::new_with_warnings( | ||
validator, | ||
vec![Warning::new_custom_meta_list_deprecated( | ||
validation.path.get_ident().unwrap(), | ||
validation.span(), | ||
)], | ||
) | ||
}, | ||
) | ||
} | ||
} | ||
} |
14 changes: 9 additions & 5 deletions
14
serde_valid_derive/src/attribute/variant_validate/meta/meta_name_value.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_name_value, | ||
MetaNameValueStructValidation, Validator, | ||
use crate::{ | ||
attribute::{ | ||
common::message_format::MessageFormat, | ||
struct_validate::generic::extract_generic_struct_custom_validator_from_meta_name_value, | ||
MetaNameValueStructValidation, Validator, | ||
}, | ||
warning::WithWarnings, | ||
}; | ||
|
||
#[inline] | ||
pub fn extract_variant_validator_from_meta_name_value( | ||
validation_type: MetaNameValueStructValidation, | ||
validation: &syn::MetaNameValue, | ||
message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type { | ||
MetaNameValueStructValidation::Custom => { | ||
extract_generic_struct_custom_validator_from_meta_name_value(validation, message_format) | ||
} | ||
} | ||
.map(WithWarnings::new) | ||
} |
7 changes: 4 additions & 3 deletions
7
serde_valid_derive/src/attribute/variant_validate/meta/meta_path.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
use crate::attribute::{ | ||
common::message_format::MessageFormat, MetaPathStructValidation, Validator, | ||
use crate::{ | ||
attribute::{common::message_format::MessageFormat, MetaPathStructValidation, Validator}, | ||
warning::WithWarnings, | ||
}; | ||
|
||
#[inline] | ||
pub fn extract_variant_validator_from_meta_path( | ||
validation_type: MetaPathStructValidation, | ||
_validation: &syn::Path, | ||
_message_format: MessageFormat, | ||
) -> Result<Validator, crate::Errors> { | ||
) -> Result<WithWarnings<Validator>, crate::Errors> { | ||
match validation_type {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters