Skip Menu |

This queue is for tickets about the JSON-Schema CPAN distribution.

Report information
The Basics
Id: 91328
Status: new
Priority: 0/
Queue: JSON-Schema

People
Owner: Nobody in particular
Requestors: mstemm [...] cloudmark.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.015
Fixed in: (no value)



Subject: Running regex changes behavior of validation
The attached script shows a problem where executing a regex changes the behavior of a previously created JSON::Schema object. The script creates a validator, validates a json string, executes a regex, and then validates the string again. For some reason, running the regex causes the second validation to fail. Perhaps there's some predefined variable that is mistakenly being overridden by executing the regex? Let me know if you need any more information.
Subject: json_validate_error_example.pl
#!/usr/bin/perl use strict; use warnings; use JSON::Schema; print "Reading item schema...\n"; my $schema = '{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "item", "description": "item json schema", "type": "object", "properties": { "created": { "type": "string", "format": "date-time" } } }'; my $item_validator = JSON::Schema->new($schema); my $example2 = '{ "created": "2013-12-04T00:00:00Z" }'; my $result = $item_validator->validate($example2); if (! $result) { print " Example (before running regex) did not validate. Errors:\n"; print " - $_\n" foreach $result->errors; die; } my ($a, $b, $c) = "foo bar baz" =~ /(\S+) (\S+) (\S+)/; $result = $item_validator->validate($example2); if (! $result) { print " Example (after running regex) did not validate. Errors:\n"; print " - $_\n" foreach $result->errors; die; }