Include X-Glean-Include-Experimental header in generated cURL examples#617
Merged
travis-hoover-glean merged 2 commits intoJul 9, 2026
Merged
Conversation
Experimental endpoints showed includeExperimental: true in the SDK code samples (from x-codeSamples) but the cURL tab omitted the required X-Glean-Include-Experimental header, since the theme generates cURL at runtime from the operation's declared parameters. Add an injectExperimentalHeaders step to the shared spec transform that declares the header (with a pre-set value, which the theme's snippet generator requires to emit it) on every operation marked x-glean-experimental, and regenerate the affected specs and docs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
chris-freeman-glean
approved these changes
Jul 9, 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.
Problem
For experimental endpoints, the SDK code samples (Python/Go/Java/TypeScript) correctly show the experimental opt-in (e.g.
includeExperimental: true), but the cURL tab omitted the requiredX-Glean-Include-Experimental: trueheader — so copy-pasting the cURL example would fail against experimental endpoints.Root cause
The two snippet types come from different pipelines:
x-codeSamplesbaked into the OpenAPI specs by Speakeasy, which emitsincludeExperimental: true.docusaurus-theme-openapi-docs(postman-code-generators) purely from the operation's declared parameters. Experimental operations never declared the header, so cURL omitted it.Key mechanism: in the theme's
ApiExplorer/buildPostmanRequest.js → setHeaders, a header parameter is only emitted into the snippet when the parameter object carries a truthyvalueproperty. Parameter objects flow verbatim from spec → page frontmatter → snippet generator.Fix
scripts/openapi-capitalize-language.mjs(shared spec-transform step for all three specs): newinjectExperimentalHeaders()that, for every operation markedx-glean-experimental, injects a requiredX-Glean-Include-Experimentalheader parameter with a pre-setvalue: 'true'(the non-standardvalueproperty is what makes the theme render it in the generated cURL). Idempotent, and runs automatically in the existingopenapi:transform:*/openapi:regenerate:*flows so it survives future spec refreshes from upstream.scripts/openapi-capitalize-language.test.tscovering injection, missing-parameters case, non-experimental operations, idempotency, and empty specs.The cURL tab now renders:
Bonus: the header now also appears in each experimental endpoint's Header Parameters docs section with a link to How experimental APIs work, which helps anyone hand-writing requests.
Testing
pnpm test— 128 passed (incl. 5 new)pnpm build— succeeds