swagger-api / swagger-api/swagger-ui

Swagger UI not rendering errors

Open
#4,757 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: rendering swagger-js type: bug
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Windows
  • Browser: Chrome
  • Version: 67.0
  • Method of installation: dist assets
  • Swagger-UI version: 3.17.x (potentially lower versions are affected as well)
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

API being split over several files
api.yaml

openapi: 3.0.0

info:
  version: v1.0
  title: Testing
  description: Testing

paths:
  /testA:
    $ref: 'testA.yaml'
  /testB:
    $ref: 'testB.yaml'

testA.yaml

get:
  responses:
    200:
      description: OK
      content:
        application/json:
          schema:
            $ref: 'non_existant.yaml#/schemas/testA'

testB.yaml

get:
  responses:
    200:
      description: OK
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                type: string
Describe the bug you're encountering

The red errors message field is not rendering. The browser console (when using inspect) however still shows the correct error about not being able to GET the the referenced resource (404 Not found).

Interestingly enough, when commenting out the path reference for testB, the error caused by testA is rendered as expected.

Judging from the intial rendering, it seems like the error is temporarily shown, then vanishing. However im not completely sure about that.

Expected behavior

Errors should be rendered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the provided api.yaml, testA.yaml, and testB.yaml with Swagger UI 3.17.x and the dist assets. Compare rendering with both path references present and with testB commented out, while checking the browser console. Done means the red error for the missing referenced resource remains visible when both paths are loaded.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.