Closed pplu closed 3 years ago
Which version of JSON::Validator, OpenAPI::Client and Mojolicious::Plugin::OpenAPI do you have? Not quite sure what's going on, but I have some other (generic) comments to the code:
plugin "Mojolicious::Plugin::OpenAPI::SpecRenderer";
? It does not seem like you use it.schema => "v3"
anymore when loading the OpenAPI pluginMight it be that this is the same issue which I have detailed in #199 ?
Which version of JSON::Validator, OpenAPI::Client and Mojolicious::Plugin::OpenAPI do you have?
carton installed from today
- Why do you have
plugin "Mojolicious::Plugin::OpenAPI::SpecRenderer";
? It does not seem like you use it.
OK, I see what happened here: I got the "get api.json" controller from the documentation, but it wasn't working for me because i had:
my $json = {
...
};
get "/api.json" => sub {
...
};
plugin OpenAPI => {spec => $json, schema => "v3"};
The api.json endpoint was returning an empty openapi definition, so It seems I got the thing to work via a plain old render (this was done some weeks ago when I was trying to use OpenAPI::Client, and I realized it didn't have support for v3, so it was a detail I didn't remember even doing).
Everything is working now by changing the "get api.json" method below the plugin load:
my $json = {
...
};
plugin OpenAPI => {spec => $json, schema => "v3"};
get "/api.json" => sub {
};
I've been able to invoke the renderspec method again, and all is working. No need to do any mangling, since https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/master/lib/Mojolicious/Plugin/OpenAPI/SpecRenderer.pm#L141 already deletes that stray basePath...
- There's no need to specify
schema => "v3"
anymore when loading the OpenAPI plugin
Thanks! I wasn't aware
- OpenAPI::Client does not have a "schema" attribute
Thanks again! That was code added while trying to diagnose what was happening!
On my side, I solved the issue, but I bumped into that strangeness of the basePath being there by accident.
Hi,
With this example server:
And this sample client:
OpenAPI::Client will die with:
I can work around the issue by adding: