Open JonMaia opened 2 years ago
This is not something we support at the moment. Feel free to create a PR to add this.
Since my api documentation is getting quite big, I have them separated in multiple files and folders. So, I also encountered this problem.
I tried to add this functionality, but, unfortunately, it seems that things are not so simple.
Extending the route definition with ->where('filename', '.+')
will instruct Laravel to pass the additional requests to get the ref files to the controller. It is necessary to handle the situations where the apidoc is spread into multiple sub-folders.
But, since it is possible to define multiple versions
in swagger-ui.php
, it makes getting the ref files a bit complicated, because for the subsequent requests the $filename
will be e.g. auth.json
, register.json
. Without the version info. We have to organise the code in sub-folders named based on the defined versions and extract the version from the url (/v1/auth.json
), or try to get the version from the $request
. From the request it can be done by using the referer
header field, which includes urls.primaryName
, or use the default version in case urls.primaryName
is missing.
I will try to dig deeper to see if I can implement a solution which handles all the situations.
Until then you can use as a workaround the swagger-cli
Node.js package, create a bundle using
swagger-cli bundle -t json -o ./resources/swagger/openapi-bundle.json ./resources/swagger/openapi.json
and use this bundle in swagger-ui.php.
Hi, I want to use remote reference as indicated in the official documentation of swagger but I would not be able to, I get an error that it does not recognize the route. I am following the convention provided by the official documentation and nothing.
I use the reference as figure in swagger inside my
openapi.json
So I have my
auth.json
with the definition that I reference.This is the file structure I have.
This is the error that appears in the swagger view
I would like to know if I am making a mistake or if I need to consider something else, or in short, it is a feature that is not currently contemplated. Thank you