From bbe71071ab06d045af255cc951fa039f851447be Mon Sep 17 00:00:00 2001 From: Erayd Date: Wed, 8 Mar 2017 14:56:44 +1300 Subject: [PATCH] Revert "An email is a string, not much else." This reverts commit 73ef463f5ee1d50db9f01069c5a060a3d354888a. 'email' is only a valid type attribute in draft-03 (later versions of the spec explicitly limit the value of type to the core primitive types), and this code doesn't validate email addresses anyway. IMO we should be validating it properly or not at all, and noting this went away after draft-03 my opinion is on the not-at-all side of the fence. Note that 'email' is *never* defined as a spec type, in any version - it just slips in under the radar of the draft-03 language which allows users to put arbitrary things in the type field. --- src/JsonSchema/Constraints/TypeConstraint.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/JsonSchema/Constraints/TypeConstraint.php b/src/JsonSchema/Constraints/TypeConstraint.php index a1db1d3a..096f5485 100644 --- a/src/JsonSchema/Constraints/TypeConstraint.php +++ b/src/JsonSchema/Constraints/TypeConstraint.php @@ -206,10 +206,6 @@ protected function validateType(&$value, $type) return is_string($value); } - if ('email' === $type) { - return is_string($value); - } - if ('null' === $type) { return is_null($value); }