jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
56 stars 58 forks source link

JSON::Validator 3.20 breaks installation of Mojolicious::Plugin::OpenAPI #193

Closed rkleemann closed 4 years ago

rkleemann commented 4 years ago

Steps to reproduce the behavior

See steps below.

Expected behavior

Installing Mojolicious::Plugin::OpenAPI with the previous version of JSON::Validator does install correctly.

$ cpanm JSON-Validator-3.19.tar.gz Mojolicious-8.33.tar.gz Mojolicious-Plugin-OpenAPI-2.21.tar.gz ... 3 distributions installed

Actual behavior

Installing Mojolicious::Plugin::OpenAPI with the current version of JSON::Validator does not install correctly.

$ cpanm JSON-Validator-3.20.tar.gz Mojolicious-8.33.tar.gz Mojolicious-Plugin-OpenAPI-2.21.tar.gz ... --> Working on Mojolicious-Plugin-OpenAPI-2.21.tar.gz Fetching file:///./Mojolicious-Plugin-OpenAPI-2.21.tar.gz ... OK Configuring Mojolicious-Plugin-OpenAPI-2.21 ... OK Building and testing Mojolicious-Plugin-OpenAPI-2.21 ... FAIL ! Installing Mojolicious-Plugin-OpenAPI-2.21.tar.gz failed. See ~/.cpanm/work/1581630149.51481/build.log for details. Retry with --force to force install it.

The relevant section from the build.log

t/v2-file.t ........................... ok
Format rule for 'unknown' is missing at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 717.
t/v2-formats.t ........................ ok
t/v2-readonly.t ....................... ok
t/v2-security.t ....................... ok
api.yml could not be found in __DATA__ section of . at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 268.
        JSON::Validator::_load_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe02772df80), "data:///api.yml") called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 409
        JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe02772df80), "data:///api.yml") called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 61
        JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe02772df80), "data:///api.yml", HASH(0x7fe02986ec50)) called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/Mojolicious/Plugin/OpenAPI.pm line 35
        Mojolicious::Plugin::OpenAPI::register(Mojolicious::Plugin::OpenAPI=HASH(0x7fe02986e9f8), Mojolicious::Lite=HASH(0x7fe029860028), HASH(0x7fe02801feb0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Plugins.pm line 46
        Mojolicious::Plugins::register_plugin(Mojolicious::Plugins=HASH(0x7fe028cfa7f0), "OpenAPI", Mojolicious::Lite=HASH(0x7fe029860028), HASH(0x7fe02801feb0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious.pm line 187
        Mojolicious::plugin(Mojolicious::Lite=HASH(0x7fe029860028), "OpenAPI", HASH(0x7fe02801feb0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Lite.pm line 46
        main::plugin("OpenAPI", HASH(0x7fe02801feb0)) called at t/v3-body.t line 13
t/v3-body.t ...........................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/v3-default.t ........................ ok
t/v3-invalid_file_refs.t .............. ok
Use of uninitialized value in string eq at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 58.
Use of uninitialized value in string eq at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 58.
t/v3-invalid_file_refs_no_path.t ...... ok
nullable.json could not be found in __DATA__ section of . at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 268.
        JSON::Validator::_load_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe216a1d5f0), "data:///nullable.json") called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 409
        JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe216a1d5f0), "data:///nullable.json") called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 61
        JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fe216a1d5f0), "data:///nullable.json", HASH(0x7fe216a1d920)) called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/Mojolicious/Plugin/OpenAPI.pm line 35
        Mojolicious::Plugin::OpenAPI::register(Mojolicious::Plugin::OpenAPI=HASH(0x7fe216a1d6c8), Mojolicious::Lite=HASH(0x7fe219122410), HASH(0x7fe216029188)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Plugins.pm line 46
        Mojolicious::Plugins::register_plugin(Mojolicious::Plugins=HASH(0x7fe2174b23f0), "OpenAPI", Mojolicious::Lite=HASH(0x7fe219122410), HASH(0x7fe216029188)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious.pm line 187
        Mojolicious::plugin(Mojolicious::Lite=HASH(0x7fe219122410), "OpenAPI", HASH(0x7fe216029188)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Lite.pm line 46
        main::plugin("OpenAPI", HASH(0x7fe216029188)) called at t/v3-nullable.t line 14
t/v3-nullable.t .......................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/v3-security.t ....................... ok
parameters.json could not be found in __DATA__ section of . at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 268.
        JSON::Validator::_load_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fb3b280e220), "data:///parameters.json") called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 409
        JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fb3b280e220), "data:///parameters.json") called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 61
        JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7fb3b280e220), "data:///parameters.json", HASH(0x7fb3b280e5c8)) called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/Mojolicious/Plugin/OpenAPI.pm line 35
        Mojolicious::Plugin::OpenAPI::register(Mojolicious::Plugin::OpenAPI=HASH(0x7fb3b280e298), Mojolicious::Lite=HASH(0x7fb3b32fe228), HASH(0x7fb3b28036b0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Plugins.pm line 46
        Mojolicious::Plugins::register_plugin(Mojolicious::Plugins=HASH(0x7fb3b48da1f0), "OpenAPI", Mojolicious::Lite=HASH(0x7fb3b32fe228), HASH(0x7fb3b28036b0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious.pm line 187
        Mojolicious::plugin(Mojolicious::Lite=HASH(0x7fb3b32fe228), "OpenAPI", HASH(0x7fb3b28036b0)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Lite.pm line 46
        main::plugin("OpenAPI", HASH(0x7fb3b28036b0)) called at t/v3-style-array.t line 44
t/v3-style-array.t ....................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/v3-valid_file_refs.t ................ ok
petstore.json could not be found in __DATA__ section of . at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 268.
        JSON::Validator::_load_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7f95bd13cd00), "data:///petstore.json") called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/JSON/Validator.pm line 409
        JSON::Validator::_resolve(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7f95bd13cd00), "data:///petstore.json") called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 61
        JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x7f95bd13cd00), "data:///petstore.json", HASH(0x7f95bd13d030)) called at /Users/bkleemann/.cpanm/work/1581630149.51481/Mojolicious-Plugin-OpenAPI-2.21/blib/lib/Mojolicious/Plugin/OpenAPI.pm line 35
        Mojolicious::Plugin::OpenAPI::register(Mojolicious::Plugin::OpenAPI=HASH(0x7f95bd13cdd8), Mojolicious::Lite=HASH(0x7f95bd063610), HASH(0x7f95bd067a20)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Plugins.pm line 46
        Mojolicious::Plugins::register_plugin(Mojolicious::Plugins=HASH(0x7f95bd0673f0), "OpenAPI", Mojolicious::Lite=HASH(0x7f95bd063610), HASH(0x7f95bd067a20)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious.pm line 187
        Mojolicious::plugin(Mojolicious::Lite=HASH(0x7f95bd063610), "OpenAPI", HASH(0x7f95bd067a20)) called at /Users/bkleemann/.plenv/versions/5.30.0/lib/perl5/site_perl/5.30.0/Mojolicious/Lite.pm line 46
        main::plugin("OpenAPI", HASH(0x7f95bd067a20)) called at t/v3.t line 39
t/v3.t ................................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
karenetheridge commented 4 years ago

@rkleeman if you escape the build log snippets with ``` (three backticks) above and below, the log lines will be more readable -- some characters are being lost in markdown rendering.

karenetheridge commented 4 years ago

It looks like something went wrong with the new implementation of data_section.

rkleemann commented 4 years ago

@karenetheridge: Thanks for the tip, updated for readability.

jhthorsen commented 4 years ago

Indeed something was wrong with data_section(). Will be fixed in 3.21. Going to hold the release off for a little while, since @karenetheridge has some changes I want to include, but it will be released today.