swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

External reference silently fails to generate (console gives HTTP 500 error)

Open AnotherButler opened this issue 4 years ago • 1 comments

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:

  1. Go to editor.swagger.io
  2. Add provided YAML content.
  3. Click on Generate Client.
  4. Select html. No error message appears, and the generation silently fails.
  5. Right click on the YAML.
  6. In the popup box, choose Inspect.
  7. On the right, choose the Console tab. This shows failures.
  8. 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: image

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

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.

AnotherButler avatar Apr 08 '21 23:04 AnotherButler

+1

andy380743909 avatar Jun 21 '21 04:06 andy380743909