Skip to content

API Explorer for V2 APIs (based on Scalar OpenAPI UI) - #5201

Open
epugh wants to merge 8 commits into
apache:mainfrom
epugh:api-explorer-demo
Open

epugh wants to merge 8 commits into
apache:mainfrom
epugh:api-explorer-demo

Conversation

@epugh

@epugh epugh commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Expose Scalar OpenAPI Explorer ui in our webapp for the V2 APIs.

image

Solution

Scalar is opensource librarby that we have intergrated in a fairly "minimal" fashiong. We leverage the Node tooling so we download the scalar libs at build time, but the whole app lives outside of our Solr Admin UI, in a parralle directory. This was for seperation, but also because our Angular App and the SPA of Scalar fight if they are in the same window. Scalar is embedded as an iframe.

It comumes the current openapi spec.

Tests

manual + a new selenium test.

epugh and others added 3 commits October 22, 2026 21:26
Regenerates the OpenAPI spec, fetches swagger-ui-dist via npm, and drops a
same-origin Swagger UI page into a running `./gradlew dev` instance so you
can "Try it out" against a real local Solr without writing client code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzzUgiebQ8ZhhgE2E7ZZU5
Adds a static Swagger UI page at /solr/libs/swagger-ui/, built from the same
OpenAPI spec that feeds the generated SolrJ clients:
 - :solr:webapp now consumes :solr:api's openapiSpec artifact and bakes it
   into the war as spec.json, so it ships in sync with the running version.
 - ApiMetadata now declares a relative `servers: [{url: "/api"}]` entry so
   "Try it out" calls stay same-origin with whichever node serves the page,
   with no CORS setup needed.
 - swagger-ui-dist's bundle/preset/css are vendored under web/libs/swagger-ui/,
   attributed in NOTICE.txt alongside the project's other bundled JS libraries.
 - The init call lives in its own openapi-init.js rather than an inline
   <script>, since Solr's CSP header (script-src 'self', no 'unsafe-inline')
   silently drops inline scripts.
 - Linked from the Admin UI's footer nav (opens in a new tab, parallel to
   the Admin UI rather than embedded in its routing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzzUgiebQ8ZhhgE2E7ZZU5
./gradlew :solr:webapp:rat failed on the API Explorer files added in the
previous commit:
 - index.html and openapi-init.js are first-party; they were missing the
   standard ASF header.
 - swagger-ui-bundle.js, swagger-ui-standalone-preset.js, swagger-ui.css, and
   index.css are vendored from swagger-ui-dist unmodified. Webpack strips
   their own and their bundled dependencies' license text out into sibling
   *.LICENSE.txt files rather than leaving a recognizable header in the
   minified output, so RAT can't classify them - excluded by path instead,
   following the precedent set by :solr:server's vendored Jetty config files.

Also vendors the two *.LICENSE.txt files themselves (already covered by the
blanket "**/*.txt" RAT exclude), since they document the MIT/Apache-licensed
third-party code swagger-ui-dist itself bundles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzzUgiebQ8ZhhgE2E7ZZU5
@github-actions github-actions Bot added documentation Improvements or additions to documentation tool:build admin-ui cat:api scripts labels Oct 23, 2026
@nick-boss-tech

nick-boss-tech commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Draft Review:

  • License handling is incomplete. Both vendored JavaScript bundles reference missing license files. Precommit also fails :solr:webapp:rat for all six new Swagger UI resources. Add the required headers and upstream notices, then verify the packaged output.
  • Document the shipped explorer URL separately from the developer helper.
  • Replace SOLR-XXXXX and add the changelog.
  • Add a smoke test for the packaged explorer; current tests do not establish that it works.

AI-generated. Details available upon request.

@github-actions github-actions Bot added dependencies Dependency upgrades and removed scripts labels Oct 24, 2026
@epugh epugh changed the title Api explorer demo (based on swagger ui) Api explorer demo (based on Scalar OpenAPI UI) Oct 25, 2026
@epugh
epugh marked this pull request as ready for review October 25, 2026 15:14
@epugh
epugh requested a review from gerlowskija October 25, 2026 15:14
@epugh

epugh commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

I started with Swagger UI, but it was just kind of clunky and old feeling. I found this compatible UI Scalar. Turns out this space has a bunch of new tools like this, all comepting to be your next mcp/llms.txt/etc generating tool! Since this is lightly integrated (just a link from our footer in the admin tool) I htink if it goes dormant, we can eliminate it in a few years pretty easily!

@epugh

epugh commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@jaykay12 you may be itnerested in this!

@janhoy

janhoy commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

I'm sceptical to vendor-owned open source like this, you never know how long it is truly open, whether their product phones home etc. But if we screen for such things it should not be risky to include. I'd prefer if the UI is just always available on a solr node.

@epugh

epugh commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

I'm sceptical to vendor-owned open source like this, you never know how long it is truly open, whether their product phones home etc. But if we screen for such things it should not be risky to include. I'd prefer if the UI is just always available on a solr node.

Yeah... All of them feel like "a burst of amazing, and then they die off". One of the last generation of these, maybe redoc or redocly now points to a casino website ;-(. I believe this is pretty isolated impact, so we can use it and toss it if needed. Good question on the phone home, I'll look.

@epugh

epugh commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

So, @gerlowskija noticed that the standalone.js file is 3.4 MB... I was trying to make this totally standalone, not part of our current Admin UI (with some sort of idea that it was easier to get rid of it if the project stagnates or if we watn to eliminate our Admin UI)... However, I'm wondering if we would rather make it part of the existing Admin UI, which primairly I think would mean that we would have it more fully in the left nav AND we wouldn't need to check in the standalone.js file??? Which maybe is what you were meaning @janhoy ?

@epugh

epugh commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Scalar is "having a moment" (not that should be why we use it), but I've seen it behind two other websites recently.. ;-)

@janhoy

janhoy commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Yes, I'd prefer it ships as a standard feature of Admin UI. Or alternatively its own servlet next to /solr, but always available.

@epugh

epugh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Okay... @gerlowskija I moved it to being built via our build tooling, no more GIANT file. @janhoy it's now a standalone html app, but integrated more closely!

@epugh

epugh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Maybe nice to haves?

@epugh epugh unassigned janhoy Nov 4, 2026
@epugh
epugh requested a review from janhoy November 4, 2026 14:25
@gerlowskija

Copy link
Copy Markdown
Contributor

What's the state of this PR @epugh ? Is it something you're looking to merge soon, or is truly just a demo as the title/description suggest and not quite ready for committing yet?

@epugh

epugh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Maybe in a future PR we actually show teh Java and JavaScript clients in the UI?

image

@epugh

epugh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@epugh epugh changed the title Api explorer demo (based on Scalar OpenAPI UI) API Explorer for V2 APIs (based on Scalar OpenAPI UI) Nov 4, 2026
@epugh

epugh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Okay, I'm going to call this "done" for now and ready for review. Lots of cool ideas of where we can go, but hoenstly, jstu getting this in will be awesome.

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

Labels

admin-ui cat:api dependencies Dependency upgrades documentation Improvements or additions to documentation jetty-server tests tool:build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants