Swagger-ui: 3.30.1 breaks path tags (endpoints don’t expand)

Created on 21 Jul 2020  Ā·  11Comments  Ā·  Source: swagger-api/swagger-ui

Q&A (please complete the following information)

  • OS: macOS
  • Browser: Chrome
  • Version: 84.0.4147.89
  • Method of installation: SwaggerUIBundle from unpkg
  • Swagger-UI version: 3.30.1
  • Swagger/OpenAPI version: OpenAPI 3.0.2

Content & configuration

Example Swagger/OpenAPI definition: example.yml

Swagger-UI configuration options:

SwaggerUIBundle({
    url: "openapi",
    dom_id: "#api-explorer",
    presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIBundle.SwaggerUIStandalonePreset
    ],
})

Describe the bug you're encountering

When opening a path that is in a tag ā€œgroupā€, it disappears and then reappears underneath the default tag.

This is a regression in 3.30.1; I temporarily set my unpkg URL to 3.30.0 (https://unpkg.com/[email protected]/swagger-ui-bundle.js) and the behavior no longer happens. I set it back to 3 to get the latest version and it started happening again.

To reproduce...

Steps to reproduce the behavior:

  1. Go to a path in a tag ā€œgroupā€
  2. Click on the path item
  3. See error: the path item will disappear and reappear further down the page under a new default tag group.
  4. The path item under the default tag will sit and spin.

Expected behavior

The path item should open in place.

Screenshots

example

bug regression

Most helpful comment

New release to resolve this issue, v3.30.2

All 11 comments

@tim-lai This bug completely breaks the swagger-ui as the API Explorer. Please investigate. It would be nice to find out which version introduces the issue so that we can pin to another older version as the workaround. Thanks in advance!

You can temporarily pin to 3.30.0 as @andrewminion-luminfire explained.

Is there something we can do from the client (browser) side? Cant update deployed code without going through hoops.

@thusithaC I think you can use raw yaml file to view in your local swagger ui with version 3.30.0

I use swagger-ui-express, how do I prevent it from using the latest swagger-ui?

@nasht00 If you are using yarn, you can add the following to your package.json file and rebuild.

  "resolutions": {
    "swagger-ui-dist": "3.30.0"
  }

There is also this for npm but I haven't tried it myself.

We had exactly the same issue. That new version 3.30.1 is breaking the visualization of schemas, and the Authorize button is disappearing. I don't know if it can be useful, but by adding DOM breakpoint on the loaded documentation, we discovered that it's the React.JS dependency which is responsible of the button disappearing :

function removeChild(parentNode, childNode) {
  if (Array.isArray(childNode)) {
    var closingComment = childNode[1];
    childNode = childNode[0];
    removeDelimitedText(parentNode, childNode, closingComment);
    parentNode.removeChild(closingComment);
  }
  parentNode.removeChild(childNode);
}

Anyway, if you are dynamically loading the swagger-ui-bundle thanks to a CDN, you should specify the version 3.30.0 which is the last working version :

- https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js
+ https://unpkg.com/[email protected]/swagger-ui-bundle.js

Same thing if you're loading your dependencies by using package.json, you should replace ^3 or 3.* by 3.30.0.

@andrewminion-luminfire Thanks for reporting. I am investigating.

New release to resolve this issue, v3.30.2

Thanks @tim-lai !

@tim-lai, jsDelivr appears to still be serving 3.30.1 for version 3. Is this going to update automatically or does it require action on Swagger's part?

Was this page helpful?
0 / 5 - 0 ratings