Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-JSON-Validator for openSUSE:Factory checked in at 2022-01-13 23:21:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-JSON-Validator (Old) and /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.1892 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-JSON-Validator" Thu Jan 13 23:21:10 2022 rev:39 rq:946123 version:5.05 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-JSON-Validator/perl-JSON-Validator.changes 2021-12-13 20:50:46.580649505 +0100 +++ /work/SRC/openSUSE:Factory/.perl-JSON-Validator.new.1892/perl-JSON-Validator.changes 2022-01-13 23:21:51.100063586 +0100 @@ -1,0 +2,9 @@ +Thu Jan 6 03:07:06 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 5.05 + see /usr/share/doc/packages/perl-JSON-Validator/Changes + + 5.05 2022-01-06T09:33:30+0900 + - Add EXPERIMETNAL support for coercing to array when posting form data + +------------------------------------------------------------------- Old: ---- JSON-Validator-5.04.tar.gz New: ---- JSON-Validator-5.05.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-JSON-Validator.spec ++++++ --- /var/tmp/diff_new_pack.SQ2YwK/_old 2022-01-13 23:21:51.468063827 +0100 +++ /var/tmp/diff_new_pack.SQ2YwK/_new 2022-01-13 23:21:51.472063830 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-JSON-Validator # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define cpan_name JSON-Validator Name: perl-JSON-Validator -Version: 5.04 +Version: 5.05 Release: 0 Summary: Validate data against a JSON schema License: Artistic-2.0 ++++++ JSON-Validator-5.04.tar.gz -> JSON-Validator-5.05.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/Changes new/JSON-Validator-5.05/Changes --- old/JSON-Validator-5.04/Changes 2021-12-09 23:54:09.000000000 +0100 +++ new/JSON-Validator-5.05/Changes 2022-01-06 01:33:30.000000000 +0100 @@ -1,5 +1,8 @@ Revision history for perl distribution JSON-Validator +5.05 2022-01-06T09:33:30+0900 + - Add EXPERIMETNAL support for coercing to array when posting form data + 5.04 2021-12-10T07:54:09+0900 - Fix coercing strings and numbers in schema specification #266 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/MANIFEST new/JSON-Validator-5.05/MANIFEST --- old/JSON-Validator-5.04/MANIFEST 2021-12-09 23:54:16.000000000 +0100 +++ new/JSON-Validator-5.05/MANIFEST 2022-01-06 01:33:46.000000000 +0100 @@ -98,6 +98,7 @@ t/openapiv2-headers.t t/openapiv2-readonly.t t/openapiv3-basic.t +t/openapiv3-coerce-array.t t/openapiv3-default-values.t t/openapiv3-discriminator.t t/openapiv3-nullable.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/META.json new/JSON-Validator-5.05/META.json --- old/JSON-Validator-5.04/META.json 2021-12-09 23:54:16.000000000 +0100 +++ new/JSON-Validator-5.05/META.json 2022-01-06 01:33:46.000000000 +0100 @@ -63,6 +63,6 @@ }, "x_IRC" : "ircs://irc.libera.chat:6697/#perl-openapi" }, - "version" : "5.04", + "version" : "5.05", "x_serialization_backend" : "JSON::PP version 4.06" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/META.yml new/JSON-Validator-5.05/META.yml --- old/JSON-Validator-5.04/META.yml 2021-12-09 23:54:16.000000000 +0100 +++ new/JSON-Validator-5.05/META.yml 2022-01-06 01:33:46.000000000 +0100 @@ -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: '5.04' +version: '5.05' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/lib/JSON/Validator/Schema/OpenAPIv3.pm new/JSON-Validator-5.05/lib/JSON/Validator/Schema/OpenAPIv3.pm --- old/JSON-Validator-5.04/lib/JSON/Validator/Schema/OpenAPIv3.pm 2021-11-21 00:59:28.000000000 +0100 +++ new/JSON-Validator-5.05/lib/JSON/Validator/Schema/OpenAPIv3.pm 2022-01-06 01:32:01.000000000 +0100 @@ -289,8 +289,10 @@ return E "/$param->{name}", [qw(object required)]; } if ($val->{exists}) { - local $self->{"validate_$direction"} = 1; $val->{content_type} //= $param->{accepts}[0]; + local $self->{coerce}{arrays} = 1 + if $val->{content_type} =~ m!^(application/x-www-form-urlencoded|multipart/form-data)$!; + local $self->{"validate_$direction"} = 1; my @errors = map { $_->path(_prefix_error_path($param->{name}, $_->path)); $_ } $self->validate($val->{value}, $param->{content}{$val->{content_type}}{schema}); $val->{valid} = @errors ? 0 : 1; @@ -304,6 +306,7 @@ sub _validate_type_array { my $self = shift; + $_[0] = [$_[0]] if ref $_[0] ne 'ARRAY' and $self->{coerce}{arrays}; return $_[1]->{schema}{nullable} && !defined $_[0] ? () : $self->SUPER::_validate_type_array(@_); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/lib/JSON/Validator.pm new/JSON-Validator-5.05/lib/JSON/Validator.pm --- old/JSON-Validator-5.04/lib/JSON/Validator.pm 2021-12-09 23:54:09.000000000 +0100 +++ new/JSON-Validator-5.05/lib/JSON/Validator.pm 2022-01-06 01:33:30.000000000 +0100 @@ -7,7 +7,7 @@ use Mojo::Util qw(sha1_sum); use Scalar::Util qw(blessed); -our $VERSION = '5.04'; +our $VERSION = '5.05'; our %SCHEMAS = ( 'http://json-schema.org/draft-04/schema#' => '+Draft4', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JSON-Validator-5.04/t/openapiv3-coerce-array.t new/JSON-Validator-5.05/t/openapiv3-coerce-array.t --- old/JSON-Validator-5.04/t/openapiv3-coerce-array.t 1970-01-01 01:00:00.000000000 +0100 +++ new/JSON-Validator-5.05/t/openapiv3-coerce-array.t 2022-01-06 01:31:43.000000000 +0100 @@ -0,0 +1,55 @@ +use Mojo::Base -strict; +use JSON::Validator; +use Test::More; + +my $schema = JSON::Validator->new->schema('data://main/openapi.yaml')->schema; +my ($body, @errors); + +subtest 'number to array' => sub { + $body = {exists => 1, value => {id => 42}}; + @errors = $schema->validate_request([post => '/test'], {body => \&body}); + is "@errors", "", "valid"; +}; + +subtest 'string to array' => sub { + $body = {exists => 1, value => {id => '42'}}; + @errors = $schema->validate_request([post => '/test'], {body => \&body}); + is "@errors", "", "valid"; +}; + +subtest 'already an array' => sub { + $body = {exists => 1, value => {id => [42, '43']}}; + @errors = $schema->validate_request([post => '/test'], {body => \&body}); + is "@errors", "", "valid"; +}; + +done_testing; + +sub body {$body} + +__DATA__ +@@ openapi.yaml +--- +openapi: 3.0.0 +info: + title: Upload test + version: 1.0.0 +servers: +- url: http://example.com/api +paths: + /test: + post: + operationId: testPost + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + properties: + id: + type: array + items: + type: integer + responses: + 200: + description: OK