Skip to content

Specified more exact types for fetching bookmark data#26651

Open
EvanHahn wants to merge 1 commit intomainfrom
chore/oembed-bookmark-types
Open

Specified more exact types for fetching bookmark data#26651
EvanHahn wants to merge 1 commit intomainfrom
chore/oembed-bookmark-types

Conversation

@EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Mar 2, 2026

no ref

This types-only change should have no user impact.

no ref

This types-only change should have no user impact.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

Walkthrough

The pull request updates the JSDoc return type annotation for the fetchBookmarkData method in the OEmbedService. The return type documentation was changed from a generic Promise<Object> to a more detailed type definition that explicitly specifies the structure of the returned object. The new type includes a version field set to '1.0', a type field set to 'bookmark', a url string field, and a metadata object derived from metascraper that excludes image and logo properties while adding optional thumbnail and icon fields. No runtime behavior, method signature, or parameters were modified.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: improving type specificity for the fetchBookmarkData return type by replacing a generic Promise with explicit JSDoc types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The description clearly relates to the changeset, describing a types-only JSDoc update for the fetchBookmarkData function with no user impact.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/oembed-bookmark-types

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
ghost/core/core/server/services/oembed/oembed-service.js (1)

261-274: Document the type parameter in this JSDoc block for full signature parity.

fetchBookmarkData(url, html, type) still has an undocumented third param, which weakens the goal of exact typing.

✏️ Suggested JSDoc adjustment
     /**
      * `@param` {string} url
      * `@param` {string} html
+     * `@param` {'bookmark'|'mention'|undefined} [type]
      *
      * `@returns` {Promise<{
      *     version: '1.0',
      *     type: 'bookmark',
      *     url: string,
      *     metadata: Omit<import('metascraper').Metadata, 'image'|'logo'> & {
      *         thumbnail?: string,
      *         icon?: string
      *     }
      * }>}
      */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/services/oembed/oembed-service.js` around lines 261 -
274, Add a JSDoc `@param` entry for the undocumented third parameter `type` on the
fetchBookmarkData function so the signature is fully described; update the block
above async fetchBookmarkData(url, html, type) to include something like `@param`
{string} type - the oEmbed type/variant (e.g., 'bookmark') and optionally
enumerate allowed values or expected effect on returned metadata so tooling and
readers have full parity with the function signature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ghost/core/core/server/services/oembed/oembed-service.js`:
- Around line 261-274: Add a JSDoc `@param` entry for the undocumented third
parameter `type` on the fetchBookmarkData function so the signature is fully
described; update the block above async fetchBookmarkData(url, html, type) to
include something like `@param` {string} type - the oEmbed type/variant (e.g.,
'bookmark') and optionally enumerate allowed values or expected effect on
returned metadata so tooling and readers have full parity with the function
signature.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1aa3c66 and 5b8c102.

📒 Files selected for processing (1)
  • ghost/core/core/server/services/oembed/oembed-service.js

@EvanHahn EvanHahn requested a review from cmraible March 2, 2026 20:22
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