jhthorsen / mojolicious-plugin-openapi

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

Correction of Base URL output #168

Closed linnhk closed 4 years ago

linnhk commented 4 years ago

I see that the issue can be solved by changing the $url from: my $url = Mojo::URL->new("http://$spec->{host}"); to my $url = Mojo::URL->new("http://$spec->{host}")->path($spec->{basePath}); as well, but I would prefer using $base_url since it's already stashed.

jhthorsen commented 4 years ago

I guess this PR means I should write some more tests for the actual output from SpecRenderer...

It won't work using the stash variable, since that will alter the URLs that are rendered later on, like here: https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/ee4d5c9346cd53194451a5509231ffe2e03c36fe/lib/Mojolicious/Plugin/OpenAPI/SpecRenderer.pm#L486

Example: schemes is [https, http], then all the links will be rendered with "http" instead of the preferred "https" scheme.