Skip to content

Task/69113 keep openapi explorer up to date#21484

Merged
toy merged 11 commits intodevfrom
task/69113-keep-openapi-explorer-up-to-date
Dec 19, 2025
Merged

Task/69113 keep openapi explorer up to date#21484
toy merged 11 commits intodevfrom
task/69113-keep-openapi-explorer-up-to-date

Conversation

@toy
Copy link
Copy Markdown
Contributor

@toy toy commented Dec 18, 2025

Ticket

https://community.openproject.org/wp/69113

What are you trying to accomplish?

  • Update openapi-explorer
  • Fix problem with base tag: openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url
  • Fix double scroll on api/docs page

What approach did you choose and why?

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@github-actions
Copy link
Copy Markdown

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the openapi-explorer library from a vendored version to a properly managed npm dependency (v2.4.786), fixing two key issues: a conflict with the HTML base tag that caused navigation problems, and double scrollbars appearing on the API docs page.

Key Changes:

  • Migrated openapi-explorer from vendor directory to npm package management
  • Added workaround for double scroll issue by explicitly setting parent element dimensions
  • Enhanced frontend dev server configuration to respect RAILS_RELATIVE_URL_ROOT
  • Added test coverage for the base URL navigation fix

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vendor/.keep Empty file to maintain vendor directory structure after removing vendored openapi-explorer
spec/features/api_docs/index_spec.rb Adds test verifying that URL fragments are added without changing the base path
frontend/package.json Adds openapi-explorer dependency and updates serve script with --serve-path parameter
frontend/package-lock.json Adds openapi-explorer and its transitive dependencies (lit, prismjs, marked, etc.)
frontend/angular.json Configures bundling of openapi-explorer.min.js as a separate non-injected bundle
app/views/api_docs/index.html.erb Updates script loading path and adds inline script to prevent double scrollbars
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

@toy toy force-pushed the task/69113-keep-openapi-explorer-up-to-date branch 3 times, most recently from ca4eb76 to 5bb785c Compare December 18, 2025 17:04
Copy link
Copy Markdown
Member

@cbliard cbliard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. It's much better than the 2 previous hacks. Thanks for pushing this forward relentlessly.

One thing that seems to not work well is the back button after clicking an OpenProject link. Here is a repro:

  • open /api/docs
  • click OpenProject logo in top bar
  • click back
    • expected: go back to api docs page
    • actual: the url is updated, but the page content is not changed.
    • fun thing: if reloading the page before using the back button, it works as expected (so I think it's related to turbo).

But that should not prevent from merging.

There is also an issue with back button inside the api docs page: it seems to store the same url twice. Here is a repro:

  • open /api/docs
  • click some links from the left menu
  • click back multiple times
    • expected: go back each time back button is pressed
    • actual: have to click twice to get the url updated
    • it was already doing it before, where the url would be /#?route=overview--introduction on first click, then /api/docs#?route=overview--introduction on second click, and so on.

Same, still good to merge IMHO because the behavior is so much better than before.

@toy toy force-pushed the task/69113-keep-openapi-explorer-up-to-date branch from 1ef3120 to 16addbe Compare December 19, 2025 17:24
@toy
Copy link
Copy Markdown
Contributor Author

toy commented Dec 19, 2025

@cbliard Thank you for review and nice finds!

First problem I resolved by disabling turbo on api docs page, so clicking menu links skips turbo which leads to also skipping turbo when navigating back (05f5b94, includes a test)

Second problem is in openapi-explorer => Authress-Engineering/openapi-explorer#293 fixed (c05ed7d)

@toy toy force-pushed the task/69113-keep-openapi-explorer-up-to-date branch from 16addbe to c05ed7d Compare December 19, 2025 20:43
@toy toy merged commit a0322c5 into dev Dec 19, 2025
20 checks passed
@toy toy deleted the task/69113-keep-openapi-explorer-up-to-date branch December 19, 2025 21:07
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2025
@cbliard
Copy link
Copy Markdown
Member

cbliard commented Dec 24, 2025

Nice one 👏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants