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

5.9.1 crashes the page #9337

Closed
mvanderlee opened this issue Oct 26, 2023 · 14 comments
Closed

5.9.1 crashes the page #9337

mvanderlee opened this issue Oct 26, 2023 · 14 comments

Comments

@mvanderlee
Copy link

5.9.1 Crashes the page when expanding methods with large schemas.
Reverting to 5.9.0 fixes the issue.

I can provide the openapi.json, but don't want to submit it here on a public forum.

@anil-enable
Copy link

anil-enable commented Oct 26, 2023

I have a smaller sample that leads to the same situation. Sharing it here, if that helps.

There is one endpoint /hello and one schema object Message. The Message schema has recursive association to itself - Message has details which is a list Message(s). Please note that details is optional on the Message schema.

The swagger UI loads but when I expand the /hello endpoint, it gets stuck and soon after the whole page becomes unresponsive.

This works on version 5.9.0, but doesn't work on the latest version 5.9.1.

{
  "openapi": "3.1.0",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "paths": {
    "/hello": {
      "get": {
        "summary": "Hello",
        "operationId": "hello_hello_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Message": {
        "properties": {
          "message": {
            "type": "string",
            "title": "Message"
          },
          "details": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Message"
                },
                "type": "array"
              }
            ],
            "title": "Details"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "Message"
      }
    }
  }
}

alejandraklachquin added a commit to alejandraklachquin/fastapi that referenced this issue Oct 26, 2023
version 5.9.1 released on 25/10/2023 has a bug related to recursive schema definitions
Issue reported at: swagger-api/swagger-ui#9337
@hellobrett
Copy link

hellobrett commented Oct 29, 2023

A monkey patch approach as a temporary workaround:

tiangolo/fastapi#1762 (comment)

@s0l4r
Copy link

s0l4r commented Nov 2, 2023

I can also confirm that downgrading from 5.9.1 to 5.9.0 works with the monkey patch. 5.9.1 freezes the UI.

@char0n
Copy link
Member

char0n commented Nov 3, 2023

Hi everybody,

I can confirm.

Here is the list of changes between 5.9.0 and 5.9.1: v5.9.0...v5.9.1

Which limits the regression either to c7d6214 or some of the dependabot updates.


Assigned high priority to this issue.

@char0n
Copy link
Member

char0n commented Nov 6, 2023

I've just verified that c7d6214 is not the cause of the issue.

One of the dependency update is causing the issue: v5.9.0...v5.9.1. If I eliminate all the dev deps, here is the list of updates that remains:

@char0n
Copy link
Member

char0n commented Nov 6, 2023

The cause of the issue is e2c2269 - updating swagger-client to >= 3.23.0. Investigating further...

@char0n
Copy link
Member

char0n commented Nov 6, 2023

Related to swagger-api/swagger-js#3173 and how swagger-client handles the cycles.

NOTE: The problem is OpenAPI 3.1.0 specific

@char0n
Copy link
Member

char0n commented Nov 6, 2023

Working on the fix in swagger-client/ApiDOM...

@char0n
Copy link
Member

char0n commented Nov 6, 2023

Underlying issues has been now addressed in ApiDOM: swagger-api/apidom#3361

Next steps: the above ApiDOM PR will be released and integrated to swagger-client during tommorow.

@char0n
Copy link
Member

char0n commented Nov 7, 2023

ApiDOM@0.83.0 with fixes has just been released. Working on integrating this release into swagger-client.

@char0n
Copy link
Member

char0n commented Nov 7, 2023

Here is a PR integrating ApiDOM@0.83.0 with swagger-client and solving proper cycle detection: swagger-api/swagger-js#3226

@char0n
Copy link
Member

char0n commented Nov 7, 2023

Fixed for swagger-client released as https://github.com/swagger-api/swagger-js/releases/tag/v3.24.5

I'll be releasing new version of SwaggerUI to make the fix explicit by new patch release, but meanwhile you can remedy your installation by doing:

 $ npm uninstall swagger-ui
 $ npm install swagger-ui

This will make sure that latest swagger-client is installing along with swagger-ui.

@char0n
Copy link
Member

char0n commented Nov 8, 2023

swagger-client@3.24.5 has been integrated in swagger-ui in #9364.

@char0n
Copy link
Member

char0n commented Nov 8, 2023

Resolved by https://github.com/swagger-api/swagger-ui/releases/tag/v5.9.2

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

5 participants