Skip to content

Ensure descriptions appear correctly.#2096

Merged
bgravenorst merged 2 commits intomainfrom
DOC-2089
Jun 18, 2025
Merged

Ensure descriptions appear correctly.#2096
bgravenorst merged 2 commits intomainfrom
DOC-2089

Conversation

@bgravenorst
Copy link
Contributor

@bgravenorst bgravenorst commented Jun 18, 2025

Description

Preserve parameter descriptions when resolving schema references

Problem

Parameter descriptions were not displaying correctly when parameters used schema references ($ref). Instead of showing the parameter-specific descriptions, the parser was displaying the generic schema titles from the referenced components.

Root Cause

The resolveRef function in RenderParams.tsx was losing the original parameter's description when resolving schema references. When a parameter had a $ref schema, the function would:

  1. Resolve the reference to get the target schema
  2. Call renderSchema with only the resolved schema
  3. Lose the original parameter's description in the process

Solution

Modified the resolveRef function to preserve the original parameter's description when resolving references:

Testing

Ensure descriptions are now displaying for methods like eth_decrypt, eth_feeHistory eth_getEncryptionPublicKey.
Ensure we still fallback to the types title when descriptions are absent.

Fixes

Fixes #2089

Checklist

Complete this checklist before merging your PR:

  • If this PR contains a major change to the documentation content, I have added an entry to the top of the "What's new?" page.
  • The proposed changes have been reviewed and approved by a member of the documentation team.

Signed-off-by: bgravenorst <byron.gravenorst@consensys.net>
Copilot AI review requested due to automatic review settings June 18, 2025 02:19
@bgravenorst bgravenorst requested review from a team as code owners June 18, 2025 02:19
@vercel
Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
metamask-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 9:04pm

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses an issue where parameter descriptions were lost when schema references were resolved in the API documentation renderer.

  • Updated the resolveRef function in RenderParams.tsx to preserve the original parameter’s description.
  • Ensured that the fallback mechanism considers the original description before defaulting to the schema's title.
Comments suppressed due to low confidence (1)

src/components/ParserOpenRPC/DetailsBox/RenderParams.tsx:15

  • Consider adding unit tests to verify that the original parameter description is preserved when resolving schema references.
  const resolveRef = (ref, originalItem) => {

Copy link
Contributor

@alexandratran alexandratran left a comment

Choose a reason for hiding this comment

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

LGTM

@bgravenorst bgravenorst merged commit 1cb728a into main Jun 18, 2025
17 of 18 checks passed
@bgravenorst bgravenorst deleted the DOC-2089 branch June 18, 2025 21:12
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.

Fix Description handling in OpenRPC component

3 participants