php-json-schema
php-json-schema copied to clipboard
Patterns don't use /
According to the examples I've seen on mailing lists, JSON Schema's patterns look like this:
{
"type": "string",
"pattern": "^[a-zA-Z]*$"
}
Your tests assume they start and end with a slash.
Is there any update on this pull request? I see that the other JSON schema project asked you to join their forces (and that's awesome), but I'd still love for this library to get this bug fixed.
+1 on the need
Even if there is a good solution to this problem, I don't know the odds of it getting merged in after 9 months. I'll try to stay hopeful though.
Still hopeful after 2 years 3 months?
Backticks don't have any special meaning within the regex AND can be used as delimiters (if escaped), therefore I believe this code should work:
if (!preg_match('' . str_replace('
', '', $schema->pattern) . '
', $entity)) {
Forked/fixed/tested here: https://github.com/shrm-org/php-json-schema