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

API Playground locks up when opening endpoint with multipart form #29211

Closed
jdcmsd opened this issue Jul 12, 2024 · 5 comments · Fixed by #29646
Closed

API Playground locks up when opening endpoint with multipart form #29211

jdcmsd opened this issue Jul 12, 2024 · 5 comments · Fixed by #29646

Comments

@jdcmsd
Copy link
Contributor

jdcmsd commented Jul 12, 2024

Parent Issue

No response

Problem Statement

Opening up any Swagger UI endpoint in the API Playground that has a multipart form component causes the browser to hang.

Screen.Recording.2024-07-12.at.12.02.33.PM.mov

I'm not sure what could be causing it, though the lockup is clearly caused by an infinite loop fetching openapi.json over and over.

Steps to Reproduce

  1. Open API Playground
  2. Expand any endpoint
  3. Now expand any end point that has "multipart" in its summary or path
    • tab will lock up
    • dev tools network tab will show looping fetches

Acceptance Criteria

Multipart form endpoints should load the same as any other, without unexpected fetch behaviors.

dotCMS Version

Trunk, 24.07.05

Proposed Objective

Documentation

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@gavriella-dotcms
Copy link
Contributor

I attached another example of my browser infinitely fetching openapi.json.

API_error.mp4

@jdcmsd
Copy link
Contributor Author

jdcmsd commented Aug 16, 2024

@wezell had suggested that this might be fixed by updating our Swagger js bundle. I've been subjecting this idea to some preliminary tests, though I'm not sure I'm doing so in the correct fashion. My method:

  • Clone and build a fresh Swagger UI repo
  • Open up my dotCMS core repo and browse to /core/dotCMS/src/main/webapp/html/portlet/ext/apiplayground
  • Replace swagger-ui-bundle.js and swagger-ui-standalone-preset.js with the versions in the swagger-ui/dist/ folder
  • Rebuild dotCMS

Unfortunately, this did not solve it. However, it may be that my method is not exhaustive of the various hooks that go into the API Playground, especially considering the use of plugins via Maven/jersey/et al.

I'll try to drum up some feedback on this.

@jdcmsd
Copy link
Contributor Author

jdcmsd commented Aug 19, 2024

I tried again, but this time I also cleared my whole cache and it worked! Multipart issue gone. Important note is that the CSS file also needs to be updated in this process, or else the titles end up looking an awful mess.

So, swagger-ui-bundle.js, swagger-ui-standalone-preset.js, and swagger-ui.css all need to be replaced with a newer version in /core/dotCMS/src/main/webapp/html/portlet/ext/apiplayground.

I think we should also add some params to the three paths inside of index.jsp to better facilitate cache-busting for our users.

I can wrangle up a PR later today.

@jdcmsd jdcmsd linked a pull request Aug 19, 2024 that will close this issue
4 tasks
@jdcmsd jdcmsd self-assigned this Aug 19, 2024
@nollymar nollymar moved this from New to In Progress in dotCMS - Product Planning Aug 19, 2024
@nollymar nollymar moved this from In Progress to In Review in dotCMS - Product Planning Aug 19, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 19, 2024
### Proposed Changes
* Updates three Swagger UI generated JavaScript files
* All three were taken as-is from the current `swagger-ui` repo's
[`/dist`
folder](https://github.com/swagger-api/swagger-ui/tree/master/dist).
* Adds version URL params to the `index.jsp` file to spare users having
to clear cache

### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)
- [ ] Any further considerations about whether they ought to have come
from `swagger-ui-dist` instead of the traditional `swagger-ui`, etc.

### Screenshots

![image](https://github.com/user-attachments/assets/dffb9bbe-1608-4a9c-b1a2-d2078f1590b8)
github-merge-queue bot pushed a commit that referenced this issue Aug 19, 2024
### Proposed Changes
* Updates three Swagger UI generated JavaScript files
* All three were taken as-is from the current `swagger-ui` repo's
[`/dist`
folder](https://github.com/swagger-api/swagger-ui/tree/master/dist).
* Adds version URL params to the `index.jsp` file to spare users having
to clear cache

### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)
- [ ] Any further considerations about whether they ought to have come
from `swagger-ui-dist` instead of the traditional `swagger-ui`, etc.

### Screenshots

![image](https://github.com/user-attachments/assets/dffb9bbe-1608-4a9c-b1a2-d2078f1590b8)
@github-project-automation github-project-automation bot moved this from In Review to Internal QA in dotCMS - Product Planning Aug 19, 2024
@nollymar nollymar reopened this Aug 20, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Aug 20, 2024
@nollymar nollymar moved this from Current Sprint Backlog to Internal QA in dotCMS - Product Planning Aug 20, 2024
@valentinogiardino valentinogiardino self-assigned this Aug 26, 2024
@valentinogiardino
Copy link
Contributor

IQA Passed Internal

  • Tested on docker image: [dotcms/dotcms:trunk_ 1c414a1]
  • The API Playground no longer locks up when opening an endpoint with a multipart form.
iqa-api-playground-locks-up.mov

@valentinogiardino valentinogiardino removed their assignment Aug 26, 2024
@github-project-automation github-project-automation bot moved this from QA - Backlog to Internal QA in dotCMS - Product Planning Aug 26, 2024
@valentinogiardino valentinogiardino moved this from Internal QA to QA - Backlog in dotCMS - Product Planning Aug 26, 2024
@bryanboza
Copy link
Member

Fixed, unable to reproduce

Image

@jdcmsd jdcmsd added the LTS: Needs Backport Ticket that will be added to LTS label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants