API Docs: show full instance URL in Swagger curl examples and Request URL - #520
Merged
nicdavidson merged 3 commits intoSep 9, 2026
Merged
Conversation
…ger UI The backend emits servers[0].url as '/api/v2/<service>' (valid, portable). Swagger UI receives the spec inline, so it has no document URL to resolve that against and prints host-less curl examples and Request URLs. Prefix relative server URLs with window.location.origin at render time only; the downloaded api-spec.json keeps the relative URL. Fixes #519
The operations view passed '/api/v2/<service>' into df-try-it as baseUrl, which it uses verbatim for the resolved-URL line and the curl / Python / JS snippets, bypassing its own origin fallback. Prefix with the page origin so the snippets are copy-pasteable. Includes rebuilt dist. Refs #519
nicdavidson
deleted the
api-docs-curl-examples-and-request-url-show-rela
branch
September 9, 2026 20:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #519
Problem
Two places on the API Docs page showed a host-less
/api/v2/<service>/...:df-api-docspassed/api/v2/<service>intodf-try-itasbaseUrl. The console uses that verbatim for the resolved-URL line and the curl / Python / JS snippets, bypassing its ownwindow.location.originfallback.servers[0].url, and the spec is fed to Swagger UI inline with no document URL to resolve against, so curl / Request URL print the relative path.Fix
serviceBaseUrlis now${window.location.origin}/api/v2/<service>.servers[].urlentries are prefixed with the page origin right beforeSwaggerUI({ spec }). Absolute URLs and specs withoutserverspass through. The downloadedapi-spec.jsonkeeps the relative, portable URL.dist/.Verification
jest df-api-docs.component.spec.ts9/9 (two new tests)