aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Prouillet2018-05-29 22:22:01 +0200
committerVincent Prouillet2018-05-29 22:22:01 +0200
commit287e83a27988fb7de5871e9ce4c8ba8c515b2076 (patch)
tree58beb55b3c23efe9a49756b57cfde9996a28f54b
parent43c4c125149f68f2290f6ba5ec941174a8a5e483 (diff)
downloadvalidator-287e83a27988fb7de5871e9ce4c8ba8c515b2076.tar.bz2
Prepare for release
-rw-r--r--README.md8
-rw-r--r--validator/Cargo.toml6
-rw-r--r--validator/src/validation/mod.rs2
-rw-r--r--validator_derive/Cargo.toml6
-rw-r--r--validator_derive/src/quoting.rs1
-rw-r--r--validator_derive/tests/credit_card.rs5
-rw-r--r--validator_derive/tests/phone.rs4
-rw-r--r--validator_derive/tests/run-pass/phone.rs1
8 files changed, 26 insertions, 7 deletions
diff --git a/README.md b/README.md
index b1153e3..fa11f34 100644
--- a/README.md
+++ b/README.md
@@ -223,6 +223,10 @@ For example, the following attributes all work:
### validator
+#### 0.7.0 (2018/05/29)
+
+- Feature gate the card validator
+
#### 0.6.2 (2017/11/08)
- Fix credit card validation being incorrect in enum
@@ -237,6 +241,10 @@ For example, the following attributes all work:
### validator_derive
+#### 0.7.0 (2018/05/29)
+
+- Feature gate the card validator
+
#### 0.6.5 (2018/04/14)
- Fix path for regex starting with `::`
diff --git a/validator/Cargo.toml b/validator/Cargo.toml
index 1d57814..08f7bae 100644
--- a/validator/Cargo.toml
+++ b/validator/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "validator"
-version = "0.6.3"
+version = "0.7.0"
authors = ["Vincent Prouillet <vincent@wearewizards.io>"]
license = "MIT"
description = "Common validation functions (email, url, length, ...) and trait"
@@ -10,7 +10,7 @@ keywords = ["validation", "api", "validator"]
[dependencies]
url = "1"
-regex = "0.2"
+regex = "1"
lazy_static = "1"
idna = "0.1"
serde = "1"
@@ -21,4 +21,4 @@ phonenumber = { version = "0.2.0+8.7.0", optional = true }
[features]
phone = ["phonenumber"]
-card = ["card-validate"] \ No newline at end of file
+card = ["card-validate"]
diff --git a/validator/src/validation/mod.rs b/validator/src/validation/mod.rs
index b244108..3f1e158 100644
--- a/validator/src/validation/mod.rs
+++ b/validator/src/validation/mod.rs
@@ -36,6 +36,7 @@ pub enum Validator {
max: Option<u64>,
equal: Option<u64>,
},
+ #[cfg(feature = "card")]
CreditCard,
#[cfg(feature = "phone")]
Phone,
@@ -52,6 +53,7 @@ impl Validator {
Validator::Regex(_) => "regex",
Validator::Range {..} => "range",
Validator::Length {..} => "length",
+ #[cfg(feature = "card")]
Validator::CreditCard => "credit_card",
#[cfg(feature = "phone")]
Validator::Phone => "phone",
diff --git a/validator_derive/Cargo.toml b/validator_derive/Cargo.toml
index ee0d468..717a838 100644
--- a/validator_derive/Cargo.toml
+++ b/validator_derive/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "validator_derive"
-version = "0.6.5"
+version = "0.7.0"
authors = ["Vincent Prouillet <vincent@wearewizards.io>"]
license = "MIT"
description = "Macros 1.1 implementation of #[derive(Validate)]"
@@ -19,14 +19,14 @@ card = ["validator/card"]
syn = { version = "0.13", features = ["extra-traits"] }
quote = "0.5"
if_chain = "0"
-validator = { version = "0.6", path = "../validator"}
+validator = { version = "0.7", path = "../validator"}
[dev-dependencies]
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
compiletest_rs = "0.3"
-regex = "0.2"
+regex = "1"
lazy_static = "1"
diff --git a/validator_derive/src/quoting.rs b/validator_derive/src/quoting.rs
index 6e010d7..c78fd14 100644
--- a/validator_derive/src/quoting.rs
+++ b/validator_derive/src/quoting.rs
@@ -334,6 +334,7 @@ pub fn quote_field_validation(field_quoter: &FieldQuoter, validation: &FieldVali
Validator::Custom(_) => quote_custom_validation(&field_quoter, validation),
Validator::Contains(_) => quote_contains_validation(&field_quoter, validation),
Validator::Regex(_) => quote_regex_validation(&field_quoter, validation),
+ #[cfg(feature = "card")]
Validator::CreditCard => quote_credit_card_validation(&field_quoter, validation),
#[cfg(feature = "phone")]
Validator::Phone => quote_phone_validation(&field_quoter, validation),
diff --git a/validator_derive/tests/credit_card.rs b/validator_derive/tests/credit_card.rs
index fcb30a1..a430971 100644
--- a/validator_derive/tests/credit_card.rs
+++ b/validator_derive/tests/credit_card.rs
@@ -4,7 +4,7 @@ extern crate validator;
use validator::Validate;
-
+#[cfg(feature = "card")]
#[test]
fn can_validate_valid_card_number() {
#[derive(Debug, Validate)]
@@ -20,6 +20,7 @@ fn can_validate_valid_card_number() {
assert!(s.validate().is_ok());
}
+#[cfg(feature = "card")]
#[test]
fn bad_credit_card_fails_validation() {
#[derive(Debug, Validate)]
@@ -40,6 +41,7 @@ fn bad_credit_card_fails_validation() {
assert_eq!(errs["val"][0].params["value"], "bob");
}
+#[cfg(feature = "card")]
#[test]
fn can_specify_code_for_credit_card() {
#[derive(Debug, Validate)]
@@ -58,6 +60,7 @@ fn can_specify_code_for_credit_card() {
assert_eq!(errs["val"][0].code, "oops");
}
+#[cfg(feature = "card")]
#[test]
fn can_specify_message_for_credit_card() {
#[derive(Debug, Validate)]
diff --git a/validator_derive/tests/phone.rs b/validator_derive/tests/phone.rs
index 675d4c5..ad8f3cd 100644
--- a/validator_derive/tests/phone.rs
+++ b/validator_derive/tests/phone.rs
@@ -5,6 +5,7 @@ extern crate validator;
use validator::Validate;
+#[cfg(feature = "phone")]
#[test]
fn can_validate_phone_ok() {
#[derive(Debug, Validate)]
@@ -20,6 +21,7 @@ fn can_validate_phone_ok() {
assert!(s.validate().is_ok());
}
+#[cfg(feature = "phone")]
#[test]
fn bad_phone_fails_validation() {
#[derive(Debug, Validate)]
@@ -39,6 +41,7 @@ fn bad_phone_fails_validation() {
assert_eq!(errs["val"][0].code, "phone");
}
+#[cfg(feature = "phone")]
#[test]
fn can_specify_code_for_phone() {
#[derive(Debug, Validate)]
@@ -58,6 +61,7 @@ fn can_specify_code_for_phone() {
assert_eq!(errs["val"][0].params["value"], "bob");
}
+#[cfg(feature = "phone")]
#[test]
fn can_specify_message_for_phone() {
#[derive(Debug, Validate)]
diff --git a/validator_derive/tests/run-pass/phone.rs b/validator_derive/tests/run-pass/phone.rs
index d6dff9e..b8766db 100644
--- a/validator_derive/tests/run-pass/phone.rs
+++ b/validator_derive/tests/run-pass/phone.rs
@@ -4,6 +4,7 @@
extern crate validator;
use validator::Validate;
+#[cfg(feature = "phone")]
#[derive(Validate)]
struct Test {
#[validate(phone)]