Skip to content

Commit 1ffdea0

Browse files
committed
Merge pull request #125 from ArDeveloppement/master
Do not throw errors when using unknown/custom format
2 parents c0387d3 + c112d67 commit 1ffdea0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/JsonSchema/Constraints/FormatConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function check($element, $schema = null, $path = null, $i = null)
112112
break;
113113

114114
default:
115-
$this->addError($path, "Unknown format: " . json_encode($schema->format));
115+
// Do nothing so that custom formats can be used.
116116
break;
117117
}
118118
}

tests/JsonSchema/Tests/Constraints/FormatTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public function getValidFormats()
118118
array('::ff', 'ipv6'),
119119

120120
array('www.example.com', 'host-name'),
121+
122+
array('anything', '*'),
121123
);
122124
}
123125

@@ -158,8 +160,6 @@ public function getInvalidFormats()
158160
array(':::ff', 'ipv6'),
159161

160162
array('localhost', 'host-name'),
161-
162-
array('anything', '*'),
163163
);
164164
}
165165

0 commit comments

Comments
 (0)