Merge API explorer improvements#3523
Conversation
* 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>
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR extends the API Explorer with three main features: tag landing pages, per-operation code examples, and prerequisites rendering. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (24)
docs/_docset.ymldocs/configure/content-set/api-explorer.mddocs/elasticsearch-openapi-docs.jsondocs/elasticsearch-openapi.jsondocs/kibana-openapi.jsonsrc/Elastic.ApiExplorer/ApiCodeBlockModel.cssrc/Elastic.ApiExplorer/ApiRenderContext.cssrc/Elastic.ApiExplorer/ApiViewModel.cssrc/Elastic.ApiExplorer/Landing/LandingNavigationItem.cssrc/Elastic.ApiExplorer/Landing/LandingView.cshtmlsrc/Elastic.ApiExplorer/Landing/TagLandingView.cshtmlsrc/Elastic.ApiExplorer/Landing/TagLandingViewModel.cssrc/Elastic.ApiExplorer/OpenApiGenerator.cssrc/Elastic.ApiExplorer/Operations/OpenApiXReqAuthParser.cssrc/Elastic.ApiExplorer/Operations/OperationView.cshtmlsrc/Elastic.ApiExplorer/Operations/OperationViewModel.cssrc/Elastic.ApiExplorer/Schemas/SchemaView.cshtmlsrc/Elastic.ApiExplorer/Shared/_ApiCodeBlock.cshtmltests/Elastic.ApiExplorer.Tests/CodeSampleTests.cstests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csprojtests/Elastic.ApiExplorer.Tests/TagMetadataTests.cstests/Elastic.ApiExplorer.Tests/TestData/elasticsearch-x-req-auth-cat-indices-sample.jsontests/Elastic.ApiExplorer.Tests/TestData/kibana-openapi-no-x-req-auth-sample.jsontests/Elastic.ApiExplorer.Tests/XReqAuthTests.cs
Mpdreamz
left a comment
There was a problem hiding this comment.
Blanket LGTM review from me.
This PR merges the branch that @szabosteve and I worked on last month. In particular, it includes the following improvements: