Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Reference dont supported #15

Open
JonMaia opened this issue May 29, 2022 · 2 comments
Open

Remote Reference dont supported #15

JonMaia opened this issue May 29, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@JonMaia
Copy link

JonMaia commented May 29, 2022

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
    Captura de pantalla de 2022-05-29 10-54-07

  • So I have my auth.json with the definition that I reference.
    Captura de pantalla de 2022-05-29 10-55-02

  • This is the file structure I have.
    Captura de pantalla de 2022-05-29 10-54-22

  • This is the error that appears in the swagger view
    Captura de pantalla de 2022-05-29 10-58-25

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

@gdebrauwer
Copy link
Contributor

This is not something we support at the moment. Feel free to create a PR to add this.

@gdebrauwer gdebrauwer added the enhancement New feature or request label Oct 30, 2023
@kukukk
Copy link

kukukk commented Aug 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants