Skip to content

Instantly share code, notes, and snippets.

@ironcamel
Created September 10, 2011 23:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ironcamel/1208939 to your computer and use it in GitHub Desktop.
JSON::Schema bugfix patch
235c235
< checkProp($value, $type, $path, undef, $_changing);
---
> $self->checkProp($value, $type, $path, undef, $_changing);
283c283
< checkProp($value, $schema->{'extends'}, $path, $i, $_changing);
---
> $self->checkProp($value, $schema->{'extends'}, $path, $i, $_changing);
304,306c304,307
< if (ref $schema->{'items'} eq 'ARRAY')
< {
< for (my $i=0; $i < scalar @{ $schema->{'items'} }; $i++)
---
> my $items = $schema->{items};
> if (ref $items eq 'ARRAY')
> { # check each item in $schema->{items} vs corresponding array value
> for (my $i=0; $i < @$items; $i++)
309c310
< push @{$self->{errors}}, checkProp($x, $schema->{'items'}->[$i], $path, $i, $_changing);
---
> push @{$self->{errors}}, $self->checkProp($x, $items->[$i], $path, $i, $_changing);
312,314c313,315
< elsif (defined $schema->{'items'})
< {
< for (my $i=0; $i < scalar @{ $schema->{'items'} }; $i++)
---
> elsif (ref $items eq 'HASH')
> { # check single $schema->{items} hash vs all values in array
> for (my $i=0; $i < @$value; $i++)
317c318
< push @{$self->{errors}}, checkProp($x, $schema->{'items'}, $path, $i, $_changing);
---
> push @{$self->{errors}}, $self->checkProp($x, $items, $path, $i, $_changing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment