From 67c560dade60aacae74b65a7706b4895e87c4f2d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 15:23:47 +0200 Subject: [PATCH 1/7] Added a note about the usage of NotBlank --- reference/constraints/Email.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index d9ec28c0334..5c83a878b7e 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -88,6 +88,14 @@ Basic Usage } } +.. note:: + + As it happens with the rest of constraints, ``null`` values and empty strings + are considered valid values. Otherwise, in addition to validating this value, + you would also be requiring it, making it impossible to be optional. That's + why most of the times this constraint is combined with + :doc:`NotBlank /reference/constraints/NotBlank`. + Options ------- From 85b79ebeb3e81de1ac638f65c577d4df103b966f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 15:29:07 +0200 Subject: [PATCH 2/7] Fixed an RST syntax issue --- reference/constraints/Email.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 5c83a878b7e..2aa87d76fbb 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -94,7 +94,7 @@ Basic Usage are considered valid values. Otherwise, in addition to validating this value, you would also be requiring it, making it impossible to be optional. That's why most of the times this constraint is combined with - :doc:`NotBlank /reference/constraints/NotBlank`. + :doc:`NotBlank `. Options ------- From 483ac59caf2e2a272ff39b6b81174186ee64a272 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 15:41:26 +0200 Subject: [PATCH 3/7] Minor reword --- reference/constraints/Email.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 2aa87d76fbb..5f8f5cfadf3 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -90,8 +90,8 @@ Basic Usage .. note:: - As it happens with the rest of constraints, ``null`` values and empty strings - are considered valid values. Otherwise, in addition to validating this value, + As with the rest of the constraints, ``null`` values and empty strings are + considered valid values. Otherwise, in addition to validating this value, you would also be requiring it, making it impossible to be optional. That's why most of the times this constraint is combined with :doc:`NotBlank `. From 361b0aa0dc1abd4ed3d16061afb80bd37b8e333c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 15:46:43 +0200 Subject: [PATCH 4/7] Added the note about NotBlank in all relevant constraints --- reference/constraints/Bic.rst | 2 ++ reference/constraints/CardScheme.rst | 2 ++ reference/constraints/Country.rst | 2 ++ reference/constraints/Currency.rst | 2 ++ reference/constraints/Date.rst | 2 ++ reference/constraints/DateTime.rst | 2 ++ reference/constraints/Email.rst | 8 +------- reference/constraints/File.rst | 2 ++ reference/constraints/Iban.rst | 2 ++ reference/constraints/Ip.rst | 2 ++ reference/constraints/Isbn.rst | 2 ++ reference/constraints/Issn.rst | 2 ++ reference/constraints/Language.rst | 2 ++ reference/constraints/Length.rst | 2 ++ reference/constraints/Locale.rst | 2 ++ reference/constraints/Luhn.rst | 2 ++ reference/constraints/Regex.rst | 2 ++ reference/constraints/Time.rst | 2 ++ reference/constraints/Url.rst | 2 ++ reference/constraints/Uuid.rst | 2 ++ reference/constraints/_empty-values-are-valid.rst.inc | 7 +++++++ 21 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 reference/constraints/_empty-values-are-valid.rst.inc diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 0d4fc9aeba7..9d4e39033bc 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -83,6 +83,8 @@ will contain a Business Identifier Code (BIC). } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Available Options ----------------- diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 51707f864fd..30757d82dc5 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -96,6 +96,8 @@ on an object that will contain a credit card number. } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Available Options ----------------- diff --git a/reference/constraints/Country.rst b/reference/constraints/Country.rst index b38220b57a0..6217986b960 100644 --- a/reference/constraints/Country.rst +++ b/reference/constraints/Country.rst @@ -73,6 +73,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Currency.rst b/reference/constraints/Currency.rst index 7349ce51f8a..730be9464d1 100644 --- a/reference/constraints/Currency.rst +++ b/reference/constraints/Currency.rst @@ -79,6 +79,8 @@ a valid currency, you could do the following: } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Date.rst b/reference/constraints/Date.rst index 8d3a7e26e99..bac94f4f5d4 100644 --- a/reference/constraints/Date.rst +++ b/reference/constraints/Date.rst @@ -75,6 +75,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index 5eeddff77c4..ee557ecbfbe 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -75,6 +75,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 5f8f5cfadf3..945f9204d9e 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -88,13 +88,7 @@ Basic Usage } } -.. note:: - - As with the rest of the constraints, ``null`` values and empty strings are - considered valid values. Otherwise, in addition to validating this value, - you would also be requiring it, making it impossible to be optional. That's - why most of the times this constraint is combined with - :doc:`NotBlank `. +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc Options ------- diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 57c229e4b20..bc183a7fe42 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -150,6 +150,8 @@ The ``bioFile`` property is validated to guarantee that it is a real file. Its size and mime type are also validated because the appropriate options have been specified. +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Iban.rst b/reference/constraints/Iban.rst index 9cc754c7cbb..aa34b771a0b 100644 --- a/reference/constraints/Iban.rst +++ b/reference/constraints/Iban.rst @@ -93,6 +93,8 @@ will contain an International Bank Account Number. } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Available Options ----------------- diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index c48b57d95d1..988cf96ca64 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -76,6 +76,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index f653dfe4ab3..2ffe81ae31b 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -104,6 +104,8 @@ on an object that will contain an ISBN. } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Available Options ----------------- diff --git a/reference/constraints/Issn.rst b/reference/constraints/Issn.rst index a57832bd698..fc58a4ec722 100644 --- a/reference/constraints/Issn.rst +++ b/reference/constraints/Issn.rst @@ -79,6 +79,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index c1ae7bbf561..d1489b5ac18 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -74,6 +74,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index d4f46feb587..9083f4625da 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -110,6 +110,8 @@ and "50", you might add the following: } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index e4728a9d293..a3ca75dcd81 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -78,6 +78,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst index fe9c09d8407..8a4473fe2e7 100644 --- a/reference/constraints/Luhn.rst +++ b/reference/constraints/Luhn.rst @@ -85,6 +85,8 @@ will contain a credit card number. } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Available Options ----------------- diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index 458cf93e139..69cbc651ecd 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -161,6 +161,8 @@ it a custom message: } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 64acb618abe..ab40f76d808 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -78,6 +78,8 @@ of the day when the event starts: } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 14380b00f94..09cd73eeaaa 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -76,6 +76,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/Uuid.rst b/reference/constraints/Uuid.rst index deefad99a7e..9e6d3caaac6 100644 --- a/reference/constraints/Uuid.rst +++ b/reference/constraints/Uuid.rst @@ -78,6 +78,8 @@ Basic Usage } } +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + Options ------- diff --git a/reference/constraints/_empty-values-are-valid.rst.inc b/reference/constraints/_empty-values-are-valid.rst.inc new file mode 100644 index 00000000000..ba880dd77f3 --- /dev/null +++ b/reference/constraints/_empty-values-are-valid.rst.inc @@ -0,0 +1,7 @@ +.. note:: + + As with the rest of the constraints, ``null`` values and empty strings are + considered valid values. Otherwise, in addition to validating this value, + you would also be requiring it, making it impossible to be optional. That's + why most of the times this constraint is combined with + :doc:`NotBlank `. From 6f0dcd64498e0c9f41d3cf0714ccf77cb67f1689 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 15:48:33 +0200 Subject: [PATCH 5/7] Final reword --- reference/constraints/_empty-values-are-valid.rst.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/_empty-values-are-valid.rst.inc b/reference/constraints/_empty-values-are-valid.rst.inc index ba880dd77f3..ccea8b41d0f 100644 --- a/reference/constraints/_empty-values-are-valid.rst.inc +++ b/reference/constraints/_empty-values-are-valid.rst.inc @@ -1,7 +1,7 @@ .. note:: - As with the rest of the constraints, ``null`` values and empty strings are - considered valid values. Otherwise, in addition to validating this value, + As with most of the rest of constraints, ``null`` values and empty strings + are considered valid values. Otherwise, in addition to validating this value, you would also be requiring it, making it impossible to be optional. That's why most of the times this constraint is combined with :doc:`NotBlank `. From 52078ab6b4692fabd0c106a951eaf5e951ffe3a5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Sep 2018 16:05:03 +0200 Subject: [PATCH 6/7] Reword --- reference/constraints/_empty-values-are-valid.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/_empty-values-are-valid.rst.inc b/reference/constraints/_empty-values-are-valid.rst.inc index ccea8b41d0f..8f2aabda8ba 100644 --- a/reference/constraints/_empty-values-are-valid.rst.inc +++ b/reference/constraints/_empty-values-are-valid.rst.inc @@ -1,6 +1,6 @@ .. note:: - As with most of the rest of constraints, ``null`` values and empty strings + As with most of the other constraints, ``null`` values and empty strings are considered valid values. Otherwise, in addition to validating this value, you would also be requiring it, making it impossible to be optional. That's why most of the times this constraint is combined with From 45422dce608b2c2fa82cc9396c8f0d5eaf9ba063 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 28 Sep 2018 15:23:28 +0200 Subject: [PATCH 7/7] Minor reword --- reference/constraints/_empty-values-are-valid.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/_empty-values-are-valid.rst.inc b/reference/constraints/_empty-values-are-valid.rst.inc index 8f2aabda8ba..30c84729f84 100644 --- a/reference/constraints/_empty-values-are-valid.rst.inc +++ b/reference/constraints/_empty-values-are-valid.rst.inc @@ -3,5 +3,5 @@ As with most of the other constraints, ``null`` values and empty strings are considered valid values. Otherwise, in addition to validating this value, you would also be requiring it, making it impossible to be optional. That's - why most of the times this constraint is combined with + why it's common to combine this constraint with :doc:`NotBlank `.