Skip to content

Fix Apple Developer Docs search API - #27963

Merged
raycastbot merged 2 commits into
raycast:mainfrom
dustPyrotechnic:fix/apple-developer-docs-search-api
May 18, 2026
Merged

raycastbot merged 2 commits into
raycast:mainfrom
dustPyrotechnic:fix/apple-developer-docs-search-api

Conversation

@dustPyrotechnic

Copy link
Copy Markdown
Contributor

Description

  • replace the deprecated Apple Developer search_data.php endpoint with the current search API
  • normalize documentation, devsite, and developer search results into the existing Raycast result shape
  • keep the existing result type filter support for documentation, sample code, video, and general results

Validation

  • npm run build
  • npm run lint

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: apple-developer-docs Issues related to the apple-developer-docs extension labels May 16, 2026
@raycastbot

raycastbot commented May 16, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for your first contribution! 🎉

🔔 @CaliCastle you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="fix/apple-developer-docs-search-api"
FORK_URL="https://github.com/dustPyrotechnic/extensions.git"
EXTENSION_NAME="apple-developer-docs"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@greptile-apps

greptile-apps Bot commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the deprecated search_data.php Apple Developer search endpoint with the current production API, switching from a GET to a POST request with a JSON body and adding a full response normalization layer to map the new documentation, devsite, and developer result shapes into the existing Raycast result type.

  • New API integration: useFetch now POSTs to the new endpoint with the query in both the URL (to drive re-fetches on each keystroke) and the JSON body (text field). Response parsing is handled via normalizeResponse/normalizeResult helpers.
  • Result normalization: Three new discriminated-union result types (AppleDocumentationMetadata, AppleDevsiteMetadata, AppleDeveloperMetadata) are defined and mapped into the existing SearchResult shape, preserving filter support for documentation, sample_code, video, and general result types.
  • Type consistency fix: ResultType changed from "General" to lowercase "general", and the filteredSearchedResults comparison now lowercases both sides to handle any legacy stored history entries.

Confidence Score: 4/5

The core logic change is sound and the normalization handles all three new result shapes with safe fallbacks; the only item to fix before merging is the hardcoded date in the changelog.

The normalization pipeline correctly handles all three result shapes with safe fallbacks throughout. The changelog uses a hardcoded date instead of the required placeholder — easy fix before merging.

CHANGELOG.md — date placeholder needs to be corrected.

Important Files Changed

Filename Overview
extensions/apple-developer-docs/src/index.tsx Main entry point refactored to use POST with JSON body; adds full response normalization pipeline for documentation, devsite, and developer result types. Query is kept in the URL parameter to preserve useFetch reactivity on each keystroke.
extensions/apple-developer-docs/src/types.d.ts Adds discriminated-union types for the new Apple Search API response; changes ResultType from "General" to lowercase "general" for consistency.
extensions/apple-developer-docs/src/config.ts Replaces the deprecated search_data.php endpoint with the new Apple search API URL (already flagged in a prior thread).
extensions/apple-developer-docs/CHANGELOG.md New changelog entry added at the top; uses hardcoded date 2026-05-18 instead of the required {PR_MERGE_DATE} placeholder.
extensions/apple-developer-docs/package.json Adds "platforms": ["macOS"] to explicitly declare the extension's supported platform.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
extensions/apple-developer-docs/CHANGELOG.md:3
The changelog entry uses a hardcoded date rather than the `{PR_MERGE_DATE}` placeholder required by the Raycast extensions convention. The placeholder is automatically replaced with the actual merge date during release.

```suggestion
## [Fix Search API] - {PR_MERGE_DATE}
```

Reviews (6): Last reviewed commit: "Update CHANGELOG.md and add platforms fi..." | Re-trigger Greptile

@0xdhrv 0xdhrv 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.

Hi @dustPyrotechnic 👋

Thanks for the contribution 🔥

Could you look into the suggestions from Greptile


I converted this PR into a draft until it's ready for the review, please press the button Ready for review when it's ready and we'll have a look 😊

@0xdhrv
0xdhrv marked this pull request as draft May 16, 2026 06:50
@0xdhrv 0xdhrv self-assigned this May 16, 2026
@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from 56bafeb to 667ba4d Compare May 16, 2026 12:41
@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Updated the PR to address the review feedback:

  • Removed the duplicate ?q= query string and now send the search term only in the POST body as text, matching the current Apple search page request.
  • Added a changelog entry for the extension fix.
  • Verified the endpoint against the production https://developer.apple.com/search/scripts/search.js, which calls https://devintserv.msc.sbz.apple.com/api/v1/search from fetchSearchResults.

Validation:

  • npm run build
  • npm run lint

@dustPyrotechnic
dustPyrotechnic marked this pull request as ready for review May 16, 2026 12:41
@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from 667ba4d to 8f17bcc Compare May 16, 2026 13:00
@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Updated again based on the latest Greptile suggestions:

  • Added q back to the useFetch URL so search text changes trigger a new request. The API request still sends the actual search term via the POST body text, matching Apple’s production script.
  • Added an inline comment explaining that the URL query is only the useFetch revalidation key.
  • Changed the changelog entry date to {PR_MERGE_DATE}.

Validation:

  • npm run build
  • npm run lint

@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from 8f17bcc to d284bf8 Compare May 16, 2026 13:12
@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Handled the latest Greptile suggestion:

  • Updated first() to return undefined for missing values so createSearchResult fallbacks like config.rootUrl and Untitled can apply correctly.

Validation:

  • npm run build
  • npm run lint

@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from d284bf8 to 9443d62 Compare May 17, 2026 04:49
@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Handled the latest Greptile suggestions:

  • Normalized both sides of the searched-history type filter comparison so stored values like General still match the general filter.
  • Added results: config.maxResults to the Apple search POST body to preserve the previous result limit behavior when supported by the API.
  • Rebasing onto the latest main is included in this update.

Validation:

  • npm run build
  • npm run lint

@0xdhrv 0xdhrv 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.

Looks good to me, approved ✅

@raycastbot
raycastbot merged commit 578ff22 into raycast:main May 18, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@dustPyrotechnic).

Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

almatkai pushed a commit to almatkai/raymes-extensions that referenced this pull request Jul 13, 2026
* Fix Apple Developer Docs search API

* Update CHANGELOG.md and add platforms field

---------

Co-authored-by: raycastbot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: apple-developer-docs Issues related to the apple-developer-docs extension extension fix / improvement Label for PRs with extension's fix improvements platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants