jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 42 forks source link

Test suite fails (with JSON::Validator < 4?) #182

Closed eserte closed 4 years ago

eserte commented 4 years ago

On some of my smoker systems the tests are failing:

#   Failed test 'exact match for JSON Pointer "/responses/400/content/application~1json/schema/$ref"'
#   at t/basic-register-plugin.t line 102.
#          got: '#/definitions/_components_schemas_DefaultResponse'
#     expected: '#/components/schemas/DefaultResponse'

#   Failed test 'exact match for JSON Pointer "/responses/200/content/application~1json/schema/$ref"'
#   at t/basic-register-plugin.t line 108.
#          got: '#/definitions/_components_schemas_jobs'
#     expected: '#/components/schemas/jobs'
# Looks like you failed 2 tests of 44.
t/basic-register-plugin.t .............. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/44 subtests 
...
#   Failed test 'exact match for JSON Pointer "/components/parameters/PCVersion/name"'
#   at t/v3-valid_file_refs.t line 17.
#          got: undef
#     expected: 'pcversion'
Invalid JSON specification HASH(0x809020090):
- /: Properties not allowed: definitions. at /usr/perl5.16.3t/lib/site_perl/5.16.3/JSON/Validator.pm line 159.
    JSON::Validator::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x809030d50), "{\"components\":{\"schemas\":{\"DefaultResponse\":{\"properties\":{\"e"..., HASH(0x8085a8f78)) called at /usr/home/cpansand/.cpan/build/2020060803/Mojolicious-Plugin-OpenAPI-3.32-2/blib/lib/JSON/Validator/OpenAPI/Mojolicious.pm line 39
    JSON::Validator::OpenAPI::Mojolicious::load_and_validate_schema(JSON::Validator::OpenAPI::Mojolicious=HASH(0x809030d50), "{\"components\":{\"schemas\":{\"DefaultResponse\":{\"properties\":{\"e"..., HASH(0x8085a8f78)) called at t/v3-valid_file_refs.t line 21
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 4.
t/v3-valid_file_refs.t ................. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/4 subtests 

Statistical analysis suggests that this happens if JSON::Validator != 4.00 is installed.

jhthorsen commented 4 years ago

Oh! I forgot to bump the J::V dependency in 3.32. Fixed in b2206e0d45fcf06e6f574d8cab5bac39de4e0cfc.