Skip to content

Merge API explorer improvements#3523

Merged
lcawl merged 9 commits into
mainfrom
api-explorer-improvements
Jun 18, 2026
Merged

Merge API explorer improvements#3523
lcawl merged 9 commits into
mainfrom
api-explorer-improvements

Conversation

@lcawl

@lcawl lcawl commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

lcawl and others added 6 commits June 17, 2026 08:36
* Add multi-language code sample tabs to API Explorer request examples

Parse x-codeSamples from OpenAPI operations and render them as
language-selectable tabs (Console, cURL, Python, JS, Ruby, PHP, Java)
inline within the Request Examples section, replacing the JSON code block.
Uses the existing tabs CSS/JS infrastructure with synced language
selection across operations via sessionStorage.

Made-with: Cursor

* Fix Elastic.ApiExplorer.Tests

* Render code examples as standalone section for all HTTP methods

The inline approach only worked for operations with request bodies
(PUT/POST/PATCH). GET/DELETE operations had x-codeSamples in the
spec but no Request Examples section to host them. Move language
tabs to a standalone Code Examples section that renders for every
operation with x-codeSamples, regardless of HTTP method. Restore
original Request Examples rendering unchanged.

Made-with: Cursor

* Hide Request Examples when single example duplicates Code Examples

When an operation has exactly one request example and x-codeSamples
are present, the request example is redundant (same content shown
in richer form via language tabs). Skip rendering it to avoid
duplication.

Made-with: Cursor

---------

Co-authored-by: lcawl <lcawley@elastic.co>
@lcawl
lcawl requested review from a team as code owners June 17, 2026 15:44
@lcawl
lcawl requested a review from theletterf June 17, 2026 15:44
@lcawl
lcawl temporarily deployed to integration-tests June 17, 2026 15:44 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@lcawl, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 43 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f416ace1-6c81-458d-a51d-1af6a5f5d2d7

📥 Commits

Reviewing files that changed from the base of the PR and between 6d000bf and cb52eeb.

📒 Files selected for processing (1)
  • tests/Elastic.ApiExplorer.Tests/CodeSampleTests.cs
📝 Walkthrough

Walkthrough

The PR extends the API Explorer with three main features: tag landing pages, per-operation code examples, and prerequisites rendering. ApiTag gains ExternalDocs and TagUrlSegment fields; OpenApiGenerator now parses tag metadata, computes URL segments via GenerateTagMoniker/BuildTagMonikerMap (with collision detection), and renders TagLandingView for each tag. Navigation URL resolution is refactored so ClassificationNavigationItem points to the root API index and TagNavigationItem computes /api/{suffix}/tags/{segment}/ URLs. A new OpenApiXReqAuthParser reads x-req-auth arrays into prerequisite lines; OperationViewModel gains CodeSamples from x-codeSamples with Console-first ordering. A shared _ApiCodeBlock partial replaces inline <pre><code> blocks throughout. The docset config switches to elasticsearch-openapi-docs.json.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.87% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Merge API explorer improvements' is vague and generic, using 'improvements' without specifying what was actually improved or the main change. Replace with a more specific title that describes the primary improvements, such as 'Add tag landing pages and code sample support to API Explorer' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description references six specific pull requests that comprise the improvements, providing traceability and context for the changes, even if the detail level is minimal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch api-explorer-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/Elastic.ApiExplorer.Tests/CodeSampleTests.cs`:
- Around line 66-83: The test assertions in
CodeSamples_PreservesOrderForNonConsole are too strict and will flap because the
ParseCodeSamples method uses a comparer that returns 0 for every non-Console
pair, making their order non-deterministic. Relax the assertions to only verify
that Console appears first in the result array
(result[0].Language.Should().Be("Console")), then use a more flexible assertion
approach like verifying the remaining languages are present but without
enforcing a specific order (using Contains or similar), rather than asserting
exact index positions for Python, curl, and Ruby samples.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1ce59feb-9388-4e27-a2e2-64a1aa7ee157

📥 Commits

Reviewing files that changed from the base of the PR and between b9bf134 and 757b253.

📒 Files selected for processing (24)
  • docs/_docset.yml
  • docs/configure/content-set/api-explorer.md
  • docs/elasticsearch-openapi-docs.json
  • docs/elasticsearch-openapi.json
  • docs/kibana-openapi.json
  • src/Elastic.ApiExplorer/ApiCodeBlockModel.cs
  • src/Elastic.ApiExplorer/ApiRenderContext.cs
  • src/Elastic.ApiExplorer/ApiViewModel.cs
  • src/Elastic.ApiExplorer/Landing/LandingNavigationItem.cs
  • src/Elastic.ApiExplorer/Landing/LandingView.cshtml
  • src/Elastic.ApiExplorer/Landing/TagLandingView.cshtml
  • src/Elastic.ApiExplorer/Landing/TagLandingViewModel.cs
  • src/Elastic.ApiExplorer/OpenApiGenerator.cs
  • src/Elastic.ApiExplorer/Operations/OpenApiXReqAuthParser.cs
  • src/Elastic.ApiExplorer/Operations/OperationView.cshtml
  • src/Elastic.ApiExplorer/Operations/OperationViewModel.cs
  • src/Elastic.ApiExplorer/Schemas/SchemaView.cshtml
  • src/Elastic.ApiExplorer/Shared/_ApiCodeBlock.cshtml
  • tests/Elastic.ApiExplorer.Tests/CodeSampleTests.cs
  • tests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csproj
  • tests/Elastic.ApiExplorer.Tests/TagMetadataTests.cs
  • tests/Elastic.ApiExplorer.Tests/TestData/elasticsearch-x-req-auth-cat-indices-sample.json
  • tests/Elastic.ApiExplorer.Tests/TestData/kibana-openapi-no-x-req-auth-sample.json
  • tests/Elastic.ApiExplorer.Tests/XReqAuthTests.cs

Comment thread tests/Elastic.ApiExplorer.Tests/CodeSampleTests.cs

@Mpdreamz Mpdreamz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blanket LGTM review from me.

@lcawl
lcawl temporarily deployed to integration-tests June 18, 2026 18:06 — with GitHub Actions Inactive
@lcawl
lcawl had a problem deploying to integration-tests June 18, 2026 18:18 — with GitHub Actions Error
@lcawl
lcawl temporarily deployed to integration-tests June 18, 2026 18:20 — with GitHub Actions Inactive
@lcawl
lcawl merged commit 229342c into main Jun 18, 2026
25 checks passed
@lcawl
lcawl deleted the api-explorer-improvements branch June 18, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants