Marton Greber has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/23548 )

Change subject: Enable REST API endpoints in webserver crawl test
......................................................................


Patch Set 3:

Here's my understanding of the current Swagger UI setup with Knox:
        1.      Default Swagger UI isn't Knox-aware. The interactive buttons 
issue API calls to URLs that don't include the Knox prefix.
        2.      Our workaround (kudu-swagger-init.js, custom by Gabi):
      - Extracts {{base_url}} from the template (e.g., /KNOX-BASE)
      - Builds the spec URL with the Knox prefix: /KNOX-BASE/api/v1/spec
      - Passes it to SwaggerUIBundle, so the initial spec fetch succeeds
        3.      Why read-only viewing works:
      - swagger-ui-bundle.js is given the spec URL (it doesn't construct it)
      - Rendering the docs is just displaying text (no URL construction)
      - All assets (CSS/JS) load via {{base_url}} in docs.mustache
        4.      Why interactive features don't work:
      - swagger-ui-bundle.js constructs execution URLs internally
      - Those URLs lack the Knox prefix
      - Decision: accept read-only docs rather than patch third-party JS

Why exclude swagger-ui-bundle.js from the test:
        -       The test verifies Knox URL rewriting by parsing HTML for links.
        -       Problem: swagger-ui-bundle.js is a 1.5 MB, single-line minified 
JS file. The HTML parser (gumbo-query) treats it as HTML and extracts code 
fragments like '+escapeHtml(s[o].href)+' as bogus URLs, causing curl failures.
        -       Solution: skip parsing JS files as HTML.

Note: per commit 58177651a4, Knox doesn’t rewrite URLs inside JS files anyway, 
so testing links in JS files is incorrect and flaky.

Sharing this to aid review. Gabi - please correct anything I’ve misstated.


--
To view, visit http://gerrit.cloudera.org:8080/23548
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5be128536d4f104e2d3bfa55c02b81e6f114d5fc
Gerrit-Change-Number: 23548
Gerrit-PatchSet: 3
Gerrit-Owner: Gabriella Lotz <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Ashwani Raina <[email protected]>
Gerrit-Reviewer: Gabriella Lotz <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <[email protected]>
Gerrit-Comment-Date: Mon, 10 Nov 2025 15:28:22 +0000
Gerrit-HasComments: No

Reply via email to