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![Captura de pantalla de 2022-05-29 10-54-07](https://user-images.githubusercontent.com/42482440/170872659-51736f4d-ff15-4105-b5ea-f7e31c185396.png)
openapi.json
So I have my![Captura de pantalla de 2022-05-29 10-55-02](https://user-images.githubusercontent.com/42482440/170872725-90777592-2615-4c5d-9b8a-07073ab5e966.png)
auth.json
with the definition that I reference.This is the file structure I have.![Captura de pantalla de 2022-05-29 10-54-22](https://user-images.githubusercontent.com/42482440/170872778-3421c206-1113-4ee8-a611-3583bb1a54c7.png)
This is the error that appears in the swagger view![Captura de pantalla de 2022-05-29 10-58-25](https://user-images.githubusercontent.com/42482440/170872852-4844a773-f40b-4433-a4ed-e60a270488b5.png)
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