Skip to content

Commit

Permalink
fix openapi version not validating
Browse files Browse the repository at this point in the history
This is a change for JSON::Validator 4.00 (I think). Fixes #111. Thanks
@eserte!
  • Loading branch information
preaction committed Jun 10, 2020
1 parent 8077199 commit decd083
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Mojolicious::Plugin::OpenAPI = 2.12 ; fix the GET /api breakage
Mojolicious::Plugin::I18N = 1.6 ; Must be all-caps I18N!
Role::Tiny = 2.000001 ; Required for Mojolicious roles
Class::Method::Modifiers = 0 ; Required for around/before/after
JSON::Validator = 3.08
JSON::Validator = 4
Sys::Hostname = 0
File::Spec::Functions = 0
FindBin = 0
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/Yancy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ sub _build_validator {
# This fixes HTML forms submitting the string "20" not being
# detected as a number, or the number 1 not being detected as
# a boolean
coerce => { booleans => 1, numbers => 1 },
coerce => { booleans => 1, numbers => 1, strings => 1 },
);
my $formats = $v->formats;
$formats->{ password } = sub { undef };
Expand Down
2 changes: 1 addition & 1 deletion lib/Yancy/Plugin/Editor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ sub _openapi_spec_from_schema {
}

return {
info => $config->{info} || { title => $config->{title}, version => 1 },
info => $config->{info} || { title => $config->{title}, version => "1" },
swagger => '2.0',
host => $config->{host} // hostname(),
basePath => '/api',
Expand Down
3 changes: 2 additions & 1 deletion t/plugin/editor.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use FindBin qw( $Bin );
use Mojo::File qw( path );
use lib "".path( $Bin, '..', 'lib' );
use Local::Test qw( init_backend );
use Mojo::JSON qw( true false );
use Mojolicious;

local $ENV{MOJO_HOME} = path( $Bin, '..', 'share' );
Expand Down Expand Up @@ -54,7 +55,7 @@ subtest 'non-default backend' => sub {
properties => {
id => {
type => 'integer',
readOnly => 1,
readOnly => true,
},
name => {
type => 'string',
Expand Down

0 comments on commit decd083

Please sign in to comment.