jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this work on Mojo 9.13 ?

aimass opened this issue · comments

Env:
Docker 20.10 on macOS 10.15.7
Perl 5.32

Mojolicious-Plugin-OpenAPI-4.00 fails because JSON::Validator fails a test that is relying on format detection which AFAICT was removed in 9.11:

Disabled format detection by default to fix vulnerabilities in many Mojolicious applications. That means some of
    your routes that previously matched "/foo" and "/foo.json", will only match "/foo" after upgrading. From now on you
    will have to explicitly declare the formats your routes are allowed to handle.
#   Failed test '200 OK'
#   at t/id-keyword-draft4.t line 16.
#          got: '404'
#     expected: '200'
#   Failed test 'http://127.0.0.1:42101/relative-to-the-root.json'
#   at t/id-keyword-draft4.t line 24.
# Not Found at /root/.cpanm/work/1616442199.9/JSON-Validator-4.14/blib/lib/JSON/Validator/Store.pm line 123.

#   Failed test 'undef isa 'JSON::Validator::Schema::Draft7''
#   at t/id-keyword-draft7.t line 21.
#     undef isn't defined
Can't call method "id" on an undefined value at t/id-keyword-draft7.t line 24.

Statistical analysis also suggests that things are failing with Mojolicious 9.11+:

****************************************************************
Regression 'mod:Mojolicious'
****************************************************************
Name           	       Theta	      StdErr	 T-stat
[0='const']    	      1.0000	      0.0000	24146503157325436.00
[1='eq_8.41']  	      0.0000	      0.0000	   8.76
[2='eq_8.43']  	      0.0000	      0.0000	   8.53
[3='eq_9.0']   	      0.0000	      0.0000	   9.29
[4='eq_9.01']  	      0.0000	      0.0000	  13.33
[5='eq_9.02']  	      0.0000	      0.0000	   0.00
[6='eq_9.11']  	     -1.0000	      0.0000	-21597288991477196.00
[7='eq_9.12']  	     -1.0000	      0.0000	-19715537269316764.00
[8='eq_9.13']  	     -1.0000	      0.0000	-23740650670018220.00

R^2= 1.000, N= 144, K= 9
****************************************************************

Yeah, probably. Nonetheless the tests of JSON::Validator are using a deprecated format detection "feature". Ican confirm all is stable at Mojo 9.08 and we are using Mojolicious-Plugin-OpenAPI-4.00 happily there. Nonetheless, the default Mojo version is currently set at 9.13 so I'm guessing other users of this plugin will start getting similar issues and seems like a simple fix on the tests.

See jhthorsen/json-validator#242, I've just fixed the tests and created a pull-request for it.

The fixed JSON::Validator isn't enough as multiple Mojolicious::Plugin::OpenAPI tests are failing too.

This will be fixed in the upcoming release.

Man, you guys rock!! Thank you !!!