External reference silently fails to generate (console gives HTTP 500 error)
Q&A (please complete the following information)
- OS: Windows
- Browser: Chrome
- Version: Version 89.0.4389.90 (Official Build) (64-bit)
- Method of installation: N/A
- Swagger-Editor version: Online
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
I'm using the online tool: https://editor.swagger.io/ And trying to export to HTML
Example Swagger/OpenAPI definition:
swagger: '2.0'
info:
description: Description text.
version: v3
title: Title text.
schemes:
- https
paths:
/my/test/path:
get:
summary: Summary text.
responses:
'200':
description: Successful operation.
schema:
$ref: '#/definitions/TestArray'
definitions:
TestArray:
type: array
description: Description text.
items:
$ref: '../../external-folder/common.yaml#/definitions/Example'
Describe the bug you're encountering
When my code references an external file using a relative path (such as $ref: '../../external-folder/common.yaml#/definitions/Example'), HTML generation silently fails without any warnings.
To reproduce...
Steps to reproduce the behavior:
- Go to editor.swagger.io
- Add provided YAML content.
- Click on Generate Client.
- Select html. No error message appears, and the generation silently fails.
- Right click on the YAML.
- In the popup box, choose Inspect.
- On the right, choose the Console tab. This shows failures.
- Choose the Network tab. This shows the 500 network error.
Expected behavior
When my code references an external file using a relative path (such as $ref: '../../external-folder/common.yaml#/definitions/Example'), I expect to see a visible warning or error that referencing external files won't work, preferably indicating the line with the issue.
Screenshots
Screenshot showing console error when generating HTML:

Screenshot of 500 network error ("something bad happened"):

Additional context or thoughts
Referencing relative paths doesn't work in the online Swagger editor. It would be really helpful if the editor recognized that doesn't work and sent an error of some sort. I work with large files, so I thought maybe the file was too big, but when I broke it into smaller pieces, some pieces still failed to build. Because there was no indication what line was causing the problem or what the problem was, I removed line by line until I found the issue. As a user, I would really appreciate a warning telling me what was wrong and where it was wrong.
+1