📚 Sync docs: Fix Tafsir endpoint schema & document random verse filters & other updates#10
📚 Sync docs: Fix Tafsir endpoint schema & document random verse filters & other updates#10osamasayed merged 14 commits intoquran:mainfrom
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
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. | ||
|
|
||
| --- |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Thanks for flagging that — you were absolutely right.
The issue wasn’t with the
v4.jsonitself (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 startThe 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.
…haf--in-v4.json Fix Mushaf typo
…aceholders-in-v4.json Fix unrendered model placeholders
tokens with actual endpoints
…-tokens-in-v4.json Fix placeholder endpoints
This PR includes the following 5 important documentation updates:
Fix incorrect response schema for
/tafsirs/{resource_id}/by_ayah/{ayah_key}yarn clean-all && yarn gen-all && yarn start.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_numberThese were already available in the API but not listed in the docs.
✏️ Chore: Fix minor typos in
v4.json🧹 Fix: Replace unrendered model placeholders
#model:...tokens with proper model names in endpoint titles🔗 Fix: Replace unresolved endpoint tokens
#endpoint:HLbauN2sdGitPQPPLwith actual endpoint URLs or namesThis sync ensures the docs accurately reflect both frontend rendering stability and full API filtering capabilities.