Skip to content

Omnidoc: add API examples support and enhance example discovery#7342

Merged
PavelVanecek merged 1 commit into
mainfrom
verify-examples-fixes
May 18, 2026
Merged

Omnidoc: add API examples support and enhance example discovery#7342
PavelVanecek merged 1 commit into
mainfrom
verify-examples-fixes

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Tests only, for better example validation

Summary by CodeRabbit

Release Notes

  • New Features

    • API examples are now indexed and served alongside component examples, providing more comprehensive documentation coverage.
  • Tests

    • Enhanced test suite for API example indexing and coverage verification.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f9c9c1a3-1975-4a4e-b998-ffe45d719248

📥 Commits

Reviewing files that changed from the base of the PR and between bb38637 and f19d42e.

📒 Files selected for processing (3)
  • omnidoc/readExamples.spec.ts
  • omnidoc/readExamples.ts
  • omnidoc/verifyExamples.spec.ts

Walkthrough

This PR extends the ExampleReader class to parse and serve API examples sourced from www/src/docs/apiExamples/index.tsx. The implementation adds a map keyed by export name, updates example lookup to populate from that map, expands source globs, and implements a processing pipeline that parses defaultToolTab strings to generate /api/<name>/ entries. Tests validate the feature and adjust example coverage verification expectations.

Changes

API Example Reader and Coverage Verification

Layer / File(s) Summary
API Example Reader Implementation
omnidoc/readExamples.ts
ExampleReader gains exportToExamples map field and updated getExamples lookup. initialize adds apiExamples source globs. buildUrlMap processes www/src/docs/apiExamples/index.tsx via new processApiExamplesIndex, processApiExampleArray, and addExportExample methods that parse defaultToolTab strings (split by |), generate standardized API example entries, and deduplicate by URL.
API Example Reader Test
omnidoc/readExamples.spec.ts
Test case verifies getExamples('useXAxisTicks') returns the expected API example with correct name and /api/useXAxisTicks/ URL.
Example Coverage Verification Updates
omnidoc/verifyExamples.spec.ts
exportsThatNeedExamples list expanded with chart prop/type exports, snap-scale hook exports (useXAxis*, useYAxis*), and ZIndexLayer. New exportsThatNeedPropExamples set introduced for exports with component examples but uncovered props. describe.each blocks added to verify excluded exports have no examples and excluded-prop exports have at least one uncovered prop. Per-prop coverage checks gated to skip exports in the prop-example exclusion set.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • recharts/recharts#6979: Modifies ExampleReader.getExamples behavior for API-example retrieval and matching export/component names, directly connected to the same API-entry handling logic.
  • recharts/recharts#6897: Extends ExampleReader to populate getExamples with parsed API examples from defaultToolTab and updates related coverage assertions.
  • recharts/recharts#7239: Extends the documentation site's example rendering pipeline to pass a new Controls field, building on the API example supply capability added here.

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and contradicts the actual changes. It states 'Tests only' but the changes include significant implementation in readExamples.ts (+101 lines), not just test modifications. Update the description to accurately reflect all changes: explain the new API examples feature in readExamples.ts, the test updates in readExamples.spec.ts and verifyExamples.spec.ts, and include a 'Related Issue' section per the template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding API examples support and enhancing example discovery, which aligns with the modifications to ExampleReader and example validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch verify-examples-fixes

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.

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@chromatic-com

chromatic-com Bot commented May 18, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 193 tests unchanged
🟢 UI Review: 193 stories published -- no changes
Storybook icon Storybook Publish: 193 stories published

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.03%. Comparing base (bb38637) to head (f19d42e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7342   +/-   ##
=======================================
  Coverage   89.03%   89.03%           
=======================================
  Files         548      548           
  Lines       40522    40522           
  Branches     5569     5570    +1     
=======================================
  Hits        36079    36079           
  Misses       4434     4434           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@PavelVanecek
PavelVanecek merged commit c418b31 into main May 18, 2026
60 checks passed
@PavelVanecek
PavelVanecek deleted the verify-examples-fixes branch May 18, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant