Hello community,

here is the log from the commit of package perl-JSON-Validator for 
openSUSE:Factory checked in at 2020-09-15 16:34:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old)
 and      /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-JSON-Validator"

Tue Sep 15 16:34:34 2020 rev:22 rq:834624 version:4.03

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes  
2020-08-17 12:07:33.234766940 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.4249/perl-JSON-Validator.changes
        2020-09-15 16:35:15.850997402 +0200
@@ -1,0 +2,10 @@
+Tue Sep 15 03:09:11 UTC 2020 - Tina Müller <timueller+p...@suse.de>
+
+- updated to 4.03
+   see /usr/share/doc/packages/perl-JSON-Validator/Changes
+
+  4.03 2020-09-14T18:14:19+0900
+   - Add "joi" as exported function to JSON::Validator::Joi
+   - Fix SYNOPSIS for JSON::Validator::Joi
+
+-------------------------------------------------------------------

Old:
----
  JSON-Validator-4.02.tar.gz

New:
----
  JSON-Validator-4.03.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-JSON-Validator.spec ++++++
--- /var/tmp/diff_new_pack.H9i5u4/_old  2020-09-15 16:35:20.175001542 +0200
+++ /var/tmp/diff_new_pack.H9i5u4/_new  2020-09-15 16:35:20.179001546 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-JSON-Validator
-Version:        4.02
+Version:        4.03
 Release:        0
 %define cpan_name JSON-Validator
 Summary:        Validate data against a JSON schema

++++++ JSON-Validator-4.02.tar.gz -> JSON-Validator-4.03.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/Changes 
new/JSON-Validator-4.03/Changes
--- old/JSON-Validator-4.02/Changes     2020-08-11 06:06:40.000000000 +0200
+++ new/JSON-Validator-4.03/Changes     2020-09-14 11:14:19.000000000 +0200
@@ -1,5 +1,9 @@
 Revision history for perl distribution JSON-Validator
 
+4.03 2020-09-14T18:14:19+0900
+ - Add "joi" as exported function to JSON::Validator::Joi
+ - Fix SYNOPSIS for JSON::Validator::Joi
+
 4.02 2020-08-11T13:06:40+0900
  - Add recursive_data_protection() #220
    Contributor: Jason Cooper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/META.json 
new/JSON-Validator-4.03/META.json
--- old/JSON-Validator-4.02/META.json   2020-08-11 06:06:41.000000000 +0200
+++ new/JSON-Validator-4.03/META.json   2020-09-14 11:14:21.000000000 +0200
@@ -63,6 +63,6 @@
       },
       "x_IRC" : "irc://irc.freenode.net/#mojo"
    },
-   "version" : "4.02",
+   "version" : "4.03",
    "x_serialization_backend" : "JSON::PP version 4.04"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/META.yml 
new/JSON-Validator-4.03/META.yml
--- old/JSON-Validator-4.02/META.yml    2020-08-11 06:06:41.000000000 +0200
+++ new/JSON-Validator-4.03/META.yml    2020-09-14 11:14:20.000000000 +0200
@@ -32,5 +32,5 @@
   homepage: https://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/mojolicious/json-validator.git
-version: '4.02'
+version: '4.03'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/lib/JSON/Validator/Joi.pm 
new/JSON-Validator-4.03/lib/JSON/Validator/Joi.pm
--- old/JSON-Validator-4.02/lib/JSON/Validator/Joi.pm   2020-04-08 
07:36:21.000000000 +0200
+++ new/JSON-Validator-4.03/lib/JSON/Validator/Joi.pm   2020-09-14 
11:12:24.000000000 +0200
@@ -1,11 +1,14 @@
 package JSON::Validator::Joi;
 use Mojo::Base -base;
+use Exporter 'import';
 
 use List::Util 'uniq';
 use Mojo::JSON qw(false true);
 use Mojo::Util;
 use Storable 'dclone';
 
+our @EXPORT_OK = qw(joi);
+
 # Avoid "Subroutine redefined" warnings
 require JSON::Validator;
 
@@ -66,6 +69,7 @@
 sub integer   { shift->type('integer') }
 sub iso_date  { shift->date_time }
 sub items     { $_[0]->{items} = $_[1]; $_[0] }
+sub joi       { __PACKAGE__->new(@_) }
 sub length    { shift->min($_[0])->max($_[0]) }
 sub lowercase { shift->_type('string')->regex('^\p{Lowercase}*$') }
 sub negative  { shift->_type('number')->max(0) }
@@ -174,23 +178,30 @@
 
 =head1 SYNOPSIS
 
-  use JSON::Validator "joi";
+  use JSON::Validator::Joi "joi";
 
-  my @errors = joi(
-    {
-      name  => "Jan Henning",
-      age   => 34,
-      email => "jhthor...@cpan.org",
-    },
-    joi->object->props(
-      age   => joi->integer->min(0)->max(200),
-      email => joi->regex(".@.")->required,
-      name  => joi->string->min(1),
-    )
-  );
+  my @errors = joi->object->props(
+    age   => joi->integer->min(0)->max(200),
+    email => joi->regex(".@.")->required,
+    name  => joi->string->min(1),
+  )->validate({
+    name  => "Jan Henning",
+    age   => 34,
+    email => "jhthor...@cpan.org",
+  });
 
   die "@errors" if @errors;
 
+=head2 EXPORTED FUNCTIONS
+
+=head2 joi
+
+  $joi = joi(%attrs);
+
+Same as:
+
+  JSON::Validator::Joi->new(%attrs);
+
 =head1 DESCRIPTION
 
 L<JSON::Validator::Joi> is an elegant DSL schema-builder. The main purpose is
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/lib/JSON/Validator.pm 
new/JSON-Validator-4.03/lib/JSON/Validator.pm
--- old/JSON-Validator-4.02/lib/JSON/Validator.pm       2020-08-11 
06:06:40.000000000 +0200
+++ new/JSON-Validator-4.03/lib/JSON/Validator.pm       2020-09-14 
11:14:19.000000000 +0200
@@ -1,9 +1,9 @@
 package JSON::Validator;
 use Mojo::Base -base;
+use Exporter 'import';
 
 use B;
 use Carp 'confess';
-use Exporter 'import';
 use JSON::Validator::Formats;
 use JSON::Validator::Joi;
 use JSON::Validator::Ref;
@@ -23,7 +23,7 @@
 use constant SPECIFICATION_URL => 'http://json-schema.org/draft-04/schema#';
 use constant YAML_SUPPORT      => eval 'use YAML::XS 0.67;1';
 
-our $VERSION = '4.02';
+our $VERSION = '4.03';
 our @EXPORT_OK = qw(joi validate_json);
 
 our %SCHEMAS = (
@@ -149,7 +149,8 @@
 sub get { JSON::Validator::Util::schema_extract(shift->schema->data, shift) }
 
 sub joi {
-  Mojo::Util::deprecated('joi() will be removed in future version.');
+  Mojo::Util::deprecated(
+    'JSON::Validator::joi() is replaced by JSON::Validator::Joi::joi().');
   return JSON::Validator::Joi->new unless @_;
   my ($data, $joi) = @_;
   return $joi->validate($data, $joi);
@@ -342,7 +343,7 @@
 
   my $tx  = $self->ua->get($url);
   my $err = $tx->error && $tx->error->{message};
-  confess "GET $url == $err" if DEBUG and $err;
+  confess "GET $url == $err"               if DEBUG and $err;
   die "[JSON::Validator] GET $url == $err" if $err;
 
   if ($cache_path
@@ -518,11 +519,11 @@
     last if !$ref or ref $ref;
     $fqn = $ref =~ m!^/! ? "#$ref" : $ref;
     my ($location, $pointer) = split /#/, $fqn, 2;
-    $url = $location = _location_to_abs($location, $url);
+    $url     = $location = _location_to_abs($location, $url);
     $pointer = undef if length $location and !length $pointer;
     $pointer = url_unescape $pointer if defined $pointer;
-    $fqn   = join '#', grep defined, $location, $pointer;
-    $other = $self->_resolve($location);
+    $fqn     = join '#', grep defined, $location, $pointer;
+    $other   = $self->_resolve($location);
 
     if (defined $pointer and length $pointer and $pointer =~ m!^/!) {
       $other = Mojo::JSON::Pointer->new($other)->get($pointer);
@@ -904,7 +905,7 @@
   my @errors = $self->_validate_type_number($_[1], $path, $schema, 'integer');
 
   return @errors if @errors;
-  return if $value =~ /^-?\d+$/;
+  return         if $value =~ /^-?\d+$/;
   return E $path, [integer => type => data_type $value];
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/t/Helper.pm 
new/JSON-Validator-4.03/t/Helper.pm
--- old/JSON-Validator-4.02/t/Helper.pm 2020-06-30 10:41:36.000000000 +0200
+++ new/JSON-Validator-4.03/t/Helper.pm 2020-09-14 11:10:02.000000000 +0200
@@ -16,7 +16,7 @@
   my ($data, $joi, @expected) = @_;
   my $description
     ||= @expected ? "errors: @expected" : "valid: " . encode_json($data);
-  my @errors = JSON::Validator::joi($data, $joi);
+  my @errors = JSON::Validator::Joi->new($joi)->validate($data);
   Test::More::is_deeply(
     [map { $_->TO_JSON } sort { $a->path cmp $b->path } @errors],
     [map { $_->TO_JSON } sort { $a->path cmp $b->path } @expected],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/JSON-Validator-4.02/t/joi.t 
new/JSON-Validator-4.03/t/joi.t
--- old/JSON-Validator-4.02/t/joi.t     2020-04-10 04:18:10.000000000 +0200
+++ new/JSON-Validator-4.03/t/joi.t     2020-09-14 11:07:20.000000000 +0200
@@ -1,10 +1,8 @@
 use lib '.';
 use t::Helper;
-use JSON::Validator::Joi;
+use JSON::Validator::Joi 'joi';
 use Storable 'dclone';
 
-sub joi { JSON::Validator::Joi->new }
-
 is_deeply(
   edj(joi->object->strict->props(
     age       => joi->integer->min(0)->max(200),
@@ -33,15 +31,15 @@
       },
       color =>
         {type => 'string', minLength => 2, maxLength => 12, pattern => 
'^\w+$'},
-      date_time => {type => 'string', format    => 'date-time'},
-      email     => {type => 'string', format    => 'email'},
+      date_time => {type => 'string', format => 'date-time'},
+      email     => {type => 'string', format => 'email'},
       exists    => {type => 'boolean'},
-      lc        => {type => 'string', pattern   => '^\p{Lowercase}*$'},
-      name      => {type => 'string', minLength => 1},
-      pos       => {type => 'number', minimum   => 0},
-      token     => {type => 'string', pattern   => '^[a-zA-Z0-9_]+$'},
-      uc        => {type => 'string', pattern   => '^\p{Uppercase}*$'},
-      uri       => {type => 'string', format    => 'uri'},
+      lc    => {type => 'string', pattern   => '^\p{Lowercase}*$'},
+      name  => {type => 'string', minLength => 1},
+      pos   => {type => 'number', minimum   => 0},
+      token => {type => 'string', pattern   => '^[a-zA-Z0-9_]+$'},
+      uc    => {type => 'string', pattern   => '^\p{Uppercase}*$'},
+      uri   => {type => 'string', format    => 'uri'},
     },
     additionalProperties => false
   },


Reply via email to