Skip to content

📚 Sync docs: Fix Tafsir endpoint schema & document random verse filters & other updates#10

Merged
osamasayed merged 14 commits intoquran:mainfrom
basit3407:main
Jun 25, 2025
Merged

📚 Sync docs: Fix Tafsir endpoint schema & document random verse filters & other updates#10
osamasayed merged 14 commits intoquran:mainfrom
basit3407:main

Conversation

@basit3407
Copy link
Copy Markdown
Collaborator

@basit3407 basit3407 commented Jun 24, 2025

This PR includes the following 5 important documentation updates:

Fix incorrect response schema for /tafsirs/{resource_id}/by_ayah/{ayah_key}

  • Fixed schema in `v4.json.
  • Removed the manually written MDX file.
  • Regenerated docs using yarn clean-all && yarn gen-all && yarn start.
  • Verified that the auto-generated docs now render correctly and show the accurate response schema.

Add missing query filters for the Random Verse endpoint

  • Documented existing support for location-based filters:

    • chapter_number, page_number, juz_number, hizb_number, rub_el_hizb_number, ruku_number, manzil_number
  • These were already available in the API but not listed in the docs.

✏️ Chore: Fix minor typos in v4.json

  • Fixed minor schema typos in the OpenAPI definition file
  • Re-ran code generation commands to regenerate API docs

🧹 Fix: Replace unrendered model placeholders

  • Replaced #model:... tokens with proper model names in endpoint titles
  • Fixes display issues in autogenerated docs where model references were not resolving

🔗 Fix: Replace unresolved endpoint tokens

  • Replaced placeholder tokens like #endpoint:HLbauN2sdGitPQPPL with actual endpoint URLs or names
  • Ensures endpoint references in the docs are correctly rendered and navigable

This sync ensures the docs accurately reflect both frontend rendering stability and full API filtering capabilities.

in random verse endpoint

Added missing documentation for existing query parameters supported by the random verse endpoint:

- chapter_number
- page_number
- juz_number
- hizb_number
- rub_el_hizb_number
- ruku_number
- manzil_number

These parameters were already supported in the API but not reflected in the documentation. This update ensures developers are aware of all available filtering options when using the endpoint.
/tafsirs/{resource_id}/by_ayah/{ayah_key}

Fixed the incorrect response schema shown for the /tafsirs/{resource_id}/by_ayah/{ayah_key} endpoint in the docs.

The autogenerated version via <ApiTabs> was causing runtime crashes due to unresolved OpenAPI store references. Since that approach wasn't working despite correct infoPath and operationId setup, we manually wrote the MDX documentation using standard Docusaurus components.

Tested locally – page now renders successfully and reflects the accurate response structure.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 24, 2025

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

Name Status Preview Comments Updated (UTC)
qf-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 5:48am
Copy link
Copy Markdown
Contributor

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 updates the API documentation to correctly reflect the current behavior of two endpoints. The changes include:

  • Updating the OpenAPI schema for the tafsir endpoint by replacing the auto‐generated array ("tafsirs") with a manually written object ("tafsir") and its required properties.
  • Adding and documenting new query parameters (e.g. chapter_number, page_number, etc.) for the Random Verse endpoint.
  • Updating the MDX documentation files for both endpoints to align with the latest API design and improve error response clarity.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
openAPI/content/v4.json Revised response schema for the tafsir endpoint and added new query parameters.
docs/content_apis_versioned/random-verse.api.mdx Included additional query parameters for the Random Verse endpoint and updated docs.
docs/content_apis_versioned/list-ayah-tafsirs.api.mdx Updated the tafsir endpoint documentation to reflect the new response format and error descriptions.
Comments suppressed due to low confidence (3)

openAPI/content/v4.json:1504

  • Ensure that changing the response field from an array ('tafsirs') to an object ('tafsir') is fully consistent with the API implementation, as this modification constitutes a breaking change for clients expecting an array.
          {

docs/content_apis_versioned/random-verse.api.mdx:13

  • [nitpick] Confirm that numeric ranges use consistent formatting (e.g. en-dashes) across all query parameter descriptions for clarity and consistency.
    "description":"Return a random verse only from the specified Muṣḥaf page (1–604).",

docs/content_apis_versioned/list-ayah-tafsirs.api.mdx:109

  • Verify that the updated error descriptions for status codes 403 and 404 accurately reflect the backend responses (e.g. 403 for expired tokens or insufficient scopes, and 404 for missing resources).
<TabItem value="403">

Returns the tafsīr text for a single ayah from a specific tafsīr resource.

---
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.

Changing the content of an mdx file manually that is a result of parsing .json OpenAPI schema (openAPI/content/v4.json) risks being overridden (using yarn clean-all && yarn gen-all && yarn start). The source of truth should be the json file itself.

Copy link
Copy Markdown
Collaborator Author

@basit3407 basit3407 Jun 24, 2025

Choose a reason for hiding this comment

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

Thanks for flagging that — you were absolutely right.

The issue wasn’t with the v4.json itself (it already had the correct schema and example), but I had manually written an MDX file earlier to bypass the crash. After your comment, I deleted the manual MDX and re-ran:

yarn clean-all && yarn gen-all && yarn start

The page now renders correctly from the auto-generated docs, fully schema-driven as intended. Appreciate the catch ✅

list-ayah-tafsirs and regenerate MDX

Updated the OpenAPI schema (v4.json) for the /tafsirs/{resource_id}/by_ayah/{ayah_key} endpoint to ensure the response structure reflects the actual API output.

The previous crash with <ApiTabs> was due to incorrect or incomplete schema context. After fixing the schema, we ran:

- yarn clean-all
- yarn gen-all
- yarn start

The generated docs now render correctly and reflect the accurate response, eliminating the need for manual overrides.
@basit3407 basit3407 changed the title 📚 Sync docs: Fix Tafsir endpoint schema & document random verse filters Jun 25, 2025
@osamasayed osamasayed merged commit 9ff52da into quran:main Jun 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants