Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adjenks opened this issue Dec 28, 2018 · 0 comments
Open

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

adjenks opened this issue Dec 28, 2018 · 0 comments

Comments

@adjenks
Copy link

adjenks commented Dec 28, 2018

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: swagger-ui-dist@3.20.4
  • 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: "dude@something.com"
  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants