Repository navigation
Describe the docs API's OpenAPI document and add examples and code samples - #4942
Merged
Merged
Conversation
…mples Every operation, parameter, response, tag, schema and field has a description, and every field and parameter an example. Each operation has example requests with real responses, a curl sample per example, and the Elastic CLI command where one is released. Response examples are trimmed replies from the API, checked against the response types. The Ask AI stream response now declares its text/event-stream content. Field descriptions and examples come from doc comments, so the API, search and search contract projects generate XML documentation. Microsoft.OpenApi moves to 3.11.1, and the unused Microsoft.OpenApi.Readers pin is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4942/ Sample changed pages: |
…type - API Explorer keeps response-only examples apart when samples name them, sharing the unnamed error statuses as tabs instead of folding all into one example. - Error examples show the problem type each operation really returns. - curl samples send the cookie www.elastic.co's CDN still requires until elastic/docs-infra#523 is applied. Co-Authored-By: Claude Opus 5.5 <[email protected]>
elastic/docs-infra#523 drops production's cookie gate on the docs API, so the curl samples, the OpenAPI description and docs/data/api.md stop asking for feature_search_or_askai_enabled. Folds in #4898. Co-Authored-By: Claude Opus 5.5 <[email protected]>
akira28
added a commit
that referenced
this pull request
Nov 18, 2026
…riptions Picks up #4942: every operation, parameter and field described, example requests with real responses, and curl samples without the retired cookie. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
The docs API's OpenAPI document (
/docs/_api/v1/openapi.json) now explains itself. Every operation, parameter, response, tag, schema and field has a description, and every field and parameter has an example. Each operation also has example requests with real responses, andx-codeSampleswith a curl command and, where one is released, the Elastic CLI command.Affects: API
Prompt summary: Add examples and
x-codeSamplesto the docs API's OpenAPI document, with summaries and descriptions for operations and every field, and an example for every field. Update the OpenAPI packages.Why
The document from #4896 listed routes and types but explained nothing: no operation, parameter or field had a description, and there were no examples. API Explorer synthesizes a Console and curl sample when an operation has none, but Console is Kibana's Dev Tools and can't call this API.
What
Examples and code samples (
OpenApi/ApiExamples.cs)view=full, and a group listing forGET /apis/{api}/operations.OpenApi/Examplesand embedded in the assembly.operation-not-foundonget-api-operationandfeedback-unavailableon the feedback endpoints.x-codeSamples: a curl command per example request, labeled with the example's title so API Explorer ties them together.searchandask-ai-streamalso get the released Elastic CLI command (elastic docs search,elastic docs ask).elastic docs apiwaits for feat(docs): add elastic docs api commands cli#825.text/event-streamcontent. It was missing from the document.API Explorer: response-only examples stay apart
A GET has no request body examples, so API Explorer folded all its response examples into one scenario: the three
list-api-operationsexamples all showed the search response. Now, whenx-codeSamplesname several response-only examples, each one keeps its own response, and the unnamed ones (error statuses) are shared as status tabs. Operations whose samples name no example behave as before (OperationPageModel.Examples.cs).No more cookie gate (folds in #4898)
elastic/docs-infra#523 drops production's
feature_search_or_askai_enabledcookie gate on the docs API. The curl samples send no cookie, the OpenAPI description no longer mentions one, anddocs/data/api.mddrops the cookie sentence. Tests check that neither the description nor any curl sample names a cookie.Descriptions
OpenApi/ApiDescriptions.cs): the endpoints are lambdas, so this text lives in transformers, in one file.OKorBad Request.CS1591off), andMicrosoft.AspNetCore.OpenApi's source generator turns<summary>intodescriptionand<example>intoexamples. Writing the comments also documents those types in code.ProblemDetailscan't carry per-property comments, so a schema transformer sets theirs.crefs in existing comments. They are now plain code text.Packages
Microsoft.OpenApi3.11.0 → 3.11.1 (bug fixes only: extension preservation in copy constructors, external refs, reader allocations).dependabot.yml: 3.11.1 was published on 2026-11-16, and the bump was explicitly requested.Microsoft.AspNetCore.OpenApiis already on the latest, 11.0.0.Microsoft.OpenApi.Readers1.6.31 pin is removed. No project references it; its readers are part ofMicrosoft.OpenApisince 2.0.Verify
Locally: 319 API, 76 MCP and 1559 API Explorer tests pass, and the solution builds. The AOT publish has no warnings. The native binary serves the document with its examples,
x-codeSamplesand descriptions. Rendered with a temporary docset entry, thelist-api-operationspage shows each example with its own response (totalHits 9, 1 and 1), each with the 400, 404 and 503 tabs.Merge after elastic/docs-infra#523 is applied: until then, production answers
403to uncached requests without the cookie.Follow-up: #4897's copy of the document (
docs/docs-api.json) predates this PR. Regenerate it after this merges.🤖 Generated with Claude Code