question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reference to an external file is unsupported

See original GitHub issue

Q&A (please complete the following information)

  • OS: not relevant
  • Browser: not relevant
  • Version: I don’t understand…
  • Method of installation: docker
  • Swagger-UI version: 3.25.0
  • Swagger/OpenAPI version: not relevant

Content & configuration

Example Swagger/OpenAPI definition found at https://swagger.io/docs/specification/using-ref/#allowed-places :

    paths:
      /users:
        $ref: '../resources/users.yaml'
      /users/{userId}:
        $ref: '../resources/users-by-id.yaml'

Describe the bug you’re encountering

References to external files seem to be unsupported

To reproduce…

Steps to reproduce the behavior:

  1. Open the your inspector with F12
  2. You should see one 404 per external file you reference
  3. You will also see errors in SwaggerUI

Expected behavior

Status code 200, no errors

Additional context or thoughts

This is because only the main file is linked to the document root:

https://github.com/swagger-api/swagger-ui/blob/ba953aaa9175470fe9412b00b0ba6a8a74f78e08/docker/run.sh#L32-L33

Any file that is referenced is not copied to the document root. I worked around the bug by overriding the Docker command so that it does that copy before running the main process.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
waterkipcommented, Apr 27, 2020

@webron I have a PR that fixes this issue, been open since August 2019. https://github.com/swagger-api/swagger-ui/pull/5565

With that fix you could use volume mounts to address the problem as described in https://github.com/swagger-api/swagger-ui/issues/5966#issuecomment-615654058 like so:

docker run -p 80:8080 --rm -v $(pwd)/openapi:/opt/foo \
   -v $(pwd)/../spec.json:/opt/foo/bar \
   -e SWAGGER_JSON=/opt/foo/bar/spec.json swagger-api/swagger-ui
0reactions
tim-laicommented, Oct 6, 2020

PR #5565 was accepted and merged awhile back. Closing issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unsupported external table reference, unable to derive shape ...
I'm working to create a new table from an external file in Netezza, but am getting the following error ...
Read more >
Excel Online reporting unsupported features - Error Message
Specifically calling out "charts or objects with external references (links to other workbooks) is why the excel file won't open in the browser....
Read more >
How to Fix Unsupported File Error on Android? - YouTube
It can be frustrating to lose a photo due to file corruption. Have you ever encountered the vexing error page that appears when...
Read more >
How to Fix Unsupported File Format and Missing ... - YouTube
If you insert a USB or a memory card on your TV and the video is not playing, depending on your TV, there...
Read more >
Visual studio 2019 16.0.2. The reference is invalid or ...
As mentioned in a solution, the issue appears to be related to incorrectly referencing a project's output DLL directly. Use a project reference...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found