Honor path-level servers when prefixing path keys#100
Open
chinmaya-singal-glean wants to merge 2 commits intomainfrom
Open
Honor path-level servers when prefixing path keys#100chinmaya-singal-glean wants to merge 2 commits intomainfrom
chinmaya-singal-glean wants to merge 2 commits intomainfrom
Conversation
The transformer extracts a basePath from the global server URL and prepends
it to every path key. When a path defines its own servers: block (e.g. an
endpoint that sits under /rest/api/index instead of the API's main
/api/index/v1 prefix), the global basePath was still being prepended,
producing path keys like /api/index/v1/document/... while the path-level
server URL still carried /rest/api/index. Resolving server.url + pathKey
under OpenAPI's path-level-server-wins rule then yielded a doubled prefix
in both Redoc and Speakeasy SDK URL composition.
Now the transformer derives the prefix from a path's own server when one is
declared, and strips that basePath from the path-level server URL too — so
the resolved URL composes correctly. transformServerVariables also applies
the {domain} → {instance} rename to path-level servers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
vishwas-bhari-glean
approved these changes
May 8, 2026
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.
Summary
transform()previously prepended the global server's basePath to every path key, even when a path declared its ownservers:block. With OpenAPI's path-level-server-wins resolution rule,pathServer.url + pathKeythen composed a doubled prefix (e.g./rest/api/index+/api/index/v1/document/...), surfacing as a wrong URL in Redoc, Speakeasy SDKs, and any "Try it" widget.servers:block when one is present, and strips that basePath from the path-level server URL so the composed URL matches the global-server convention.transformServerVariablesextended to apply{domain}→{instance}to path-level servers as well, so the rename is consistent.Why now
The Custom Metadata API endpoints (currently
x-internal: true) live under/rest/api/indexrather than the indexing API's main/api/index/v1. Those endpoints are slated for GA in a follow-up PR; without this fix the published path keys and SDK URLs would be wrong.No existing fixture in
source_specs/has a path-levelservers:block, so no behavior changes for current specs — verified by the existing 54 tests still passing.Test plan
pnpm test— all 55 tests pass (added one new testhonors path-level servers when prefixing path keysbacked bytests/fixtures/path-level-servers.yaml)transform()and confirmed:/rest/api/index/document/...(its own basePath, not the global one)https://{instance}-be.glean.com{domain}→{instance}propagated through to path-level server variables