Skip to content

Externally loaded schemas do not report a failure to load. #5101

Open
@adjenks

Description

@adjenks

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Firefox and Chrome
  • Version: 64.0 and 71.0 respectively
  • Method of installation: npm
  • Swagger-UI version: [email protected]
  • Swagger/OpenAPI version: OpenAPI 3.0.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: "3.0.0"

info:
  description: "Something"
  version: "1.2.0"
  title: "Title"
  termsOfService: ""
  contact:
    email: "[email protected]"
  license:
    name: "Proprietary"

servers:
  - url: 'https://dev-superduperserver.com'
    description: Development server

security:
  - basicAuth: []

paths:
  /apath:
    get:
      operationId: doAThing
      responses:
        '200':
          content:
            application/json:
              schema:
                oneOf:
                  - "$ref": "/jsonschemas/somethingThatIsBlank.json"
                  - "$ref": "/jsonschemas/somethingThatGives404.json"

Swagger-UI configuration options:

import {SwaggerUIBundle, SwaggerUIStandalonePreset} from 'swagger-ui-dist'
import './node_modules/swagger-ui-dist/swagger-ui.css'

const ui = SwaggerUIBundle({
	url: "/openapi.yaml",
	dom_id: '#swagger-ui',
	deepLinking: true,
	presets: [
		SwaggerUIBundle.presets.apis
		,SwaggerUIStandalonePreset
	],
	plugins: [
		SwaggerUIBundle.plugins.DownloadUrl
	],
	layout: "StandaloneLayout"
	,validatorUrl: null
})
?yourQueryStringConfig

Describe the bug you're encountering

The interface does not display errors correctly when the server sends an blank response body schema or a 404 for an external schema.

I should note, CORS errors are reported correctly, which is nice.

To reproduce...

Steps to reproduce the behavior:

  1. Have the server return a 200 with an empty response body to have the spinners spin forever.
  2. Have the server return a 404 with an empty response body to have an empty schema appear with no errors.

Expected behavior

A 200 with no response body should yield some sort of warning, because the schema should at least be {}
A 404 from the server should yield a big red error somewhere.

Screenshots

When server returns 200 and empty body:
image
When server returns 404:
image

Additional context or thoughts

This is a nice bug report template, good work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions